bottaio
bottaio

Reputation: 5093

JQuery post return view with angular code

I am trying to use $.ajax to retrieve data using post request. The request goes to a ASP.NET MVC controller which returns a view which content is generated by angular.js ng-repeat. Then I am setting recievied html to a div on a page but angular is not working for me (it is not invoking directives like {{variable}}). What is a proper way to have angular-generated page displayed without reloading whole page?

Upvotes: 1

Views: 46

Answers (1)

Asqan
Asqan

Reputation: 4489

angular.bootstrap(A, ['B']);

A : your document or an ID of your div in which your angular-html code resides

B : the controller which will manipulate your angular-html

The problem is that angular does not automatically recognize the newly loaded html-codes he should manipulate. By this manner, you should tell it that there is a newly added html-code

Upvotes: 1

Related Questions