1

Although it discussed here: AngularJS with Sharepoint 2010 not working And uses of timeout in order to make the page being loaded synchronous (I don't like this solution) - it's not work.

I have loaded the html of the webpart page after the angular is loaded:

window.onload = function(){
    setTimeout(function(){       
        str+='<p>Name : <input type="text" ng-model="name" placeholder="Enter 
        name here"></p>'        
        str+='<h1>Hello {{name}}</h1>'                
        str+='<button id="submit"></button>'

        document.getElementById("ngApp").innerHTML=str;    
    }, 2500);
}

The output is: "Hello {{name}}"

    <script src=".../angularjs.js"></script>
<script src=".../code.js"></script>
2
  • Hi Eyal, are you using a server-side webpart to add HTML to the page? Commented Mar 6, 2018 at 15:44
  • Hi Denis - not, everything in the Front Commented Mar 7, 2018 at 6:01

1 Answer 1

2

When Loading Content or Libraries Async, you have to initialize AngularJS manually, after all your content and libraries are loaded. This is called manual initialization (or sometimes manual bootstrapping):

angular.bootstrap(document, ['myApp']);

Refer to the Angular Documentation for a detailed description.

1
  • Thank you! whre shoul I put the bootstrapping? Commented Mar 7, 2018 at 8:08

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.