How to load partial MVC view and keep Angular JS working
2 answers
Instead of entering your HTML manually. Go through angular.element.html or $ (). Html. Try one of the following: angular approved, parameters:
- A routing engine like ngRoute or ui-router. The mechanism can include a template that is generated by the backend.
- ngInclude . This way you can directly include HTML templates.
- Write a custom directive that injects your HTML.
Since these are AngularJS friendly methods, angular will actually parse the HTML and bind any values inside the newly loaded HTML.
+2
source to share
From the answer here
I think you might need to compile HTML string or DOM to template.
For more information, please refer to:
$ compile
https://docs.angularjs.org/api/ng/service/ $ compile
There are some topics that might help you:
AngularJS - Dynamically Generating Directive Defining Elements
AngularJS - Dynamically Generating Directive Defining Elements
Bind Angularjs to newly created html element dynamically
0
source to share