1

I'm trying to execute a controller after loading the content by ajax : Here,

    <div ng-controller="Hello">
        <p ng-bind-html="greeting.content">HTML</p>
    </div>

I'm call a controller Hello that replace HTML by :

<div ng-controller='MainCtrl'><div ng-bind-html='content'>XXXX</div></div>

So the controller MainCtrl don't execute after inserting..

app.controller('MainCtrl', function($scope) {
$scope.content = "<b>this is bold content</b><p>with a <u>paragraph</u></p>"; });

How can I do it ?

Thanks you

1
  • ng-include don't execute after innerHtml "<div ng-include="'myPartialTemplate.html'"></div>".. Commented Sep 18, 2014 at 9:31

1 Answer 1

2

You need to use ngInclude

Fetches, compiles and includes an external HTML fragment.

Example:

<div ng-include="'myPartialTemplate.html'"></div>
Sign up to request clarification or add additional context in comments.

1 Comment

Or could be done using ngRoute. code.angularjs.org/1.2.24/docs/api/ngRoute

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.