Question

I'm coming to grips with Microsoft's MVC SPA template. I've just done a tute on knockout, which seemed straightforward, and now I would like to know whether these tags, found at the beginning and end of views, are informational or functional.

<!-- ko with: register -->
    ...        
<!-- /ko -->

In this sample, the view is called _Register.cshtml and the AccountController does seem to have a method Register that takes a RegisterBindingModel, but there is also a file register.viewmodel.js the code in which looks a lot like the view models from the KO tute I just did.

Can someone explain to me how this works? I understand the MVC pattern but I'm still a little hazy on how SPA on MVC hangs together.

Are those tags perhaps some sort of RAZOR directive?

Was it helpful?

Solution

The comments are functional and useful in cases where you do not have a container element.

From the docs:

The and comments act as start/end markers, defining a “virtual element” that contains the markup inside. Knockout understands this virtual element syntax and binds as if you had a real container element.

More info

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top