0

I'm using Angular with ASP.NET MVC. In one of my razor views I include an angular template, like:

@model myViewModel;
...
<div ng-include src="'/App/myTemplate.html'"></div>
...

This works just fine, and the template shows as expected. But I would like to send a parameter from my MVC view model to the template, similar to:

<div ng-include src="'/App/myTemplate.html'" param="@myViewModel.subTitle"></div>

Is there some way this can be done?


UPDATE:

I got it to work with the onload parameter, like this:

@model myViewModel;
...
<div ng-include src="'/App/myTemplate.html'" onload="tell='@myViewModel.subTitle'"></div>
...

In myTemplate.html I have:

Here is the parameter from master view {{tell}}

I got the inspiration from over here.

Community
  • 1
  • 1
brinch
  • 2,544
  • 7
  • 33
  • 55

0 Answers0