Question

I'm in love with razor templates in .NET MVC 3. Is there anything close for javascript?

I'd be looking for something where I could use something like this:

@if(bla)
{
  <span>my html</span>
}

I already know something similar exists fo Java. What about Javascript? ;)

Was it helpful?

Solution

Maybe Knockout.js is what you're looking for.

You can do conditionals like this

<!-- ko if: $data === app.viewModel.admin.home.paging.page() -->
    <span data-bind="html: $data"></span>
<!-- /ko -->

Source: Does conditional logic work under the default knockout.js 2.0 template engine?

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