AngularJS API's Bootstrap launch

Source: Internet
Author: User

By binding to the initialization of angular, JS code will be hacked into the HTML, but for the novice use, still enough!

        {{Hello}}    </div>    < Script type= "Text/javascript" >        var mymodule = Angular.module ("myApp", []);        Mymodule.controller ("Myctrl",function($scope) {            = "hello,angular!" ;        });     </script></body>
Manual initialization

Manual binding of the Api--bootstrap is also available in angular, which is used in the following ways:

Angular.bootstrap (element, [modules], [config]);

The first parameter, element, is the DOM element that binds Ng-app;
Modules: The module name of the binding
Config: Additional configuration

Simply look at the code:

{{Hello}}</div> <script type= "Text/javascript" >varApp = Angular.module ("Bootstraptest",[]); App.controller ("Myctrl",function($scope) {$scope. Hello= "Hello,angular from bootstrap";                }); //Angular.bootstrap (document.getElementById ("Body"), [' bootstraptest ']);Angular.bootstrap (document,[' bootstraptest ']); </script></body>It is worth noting that:
 
  
    • Angular.bootstrap only binds objects that are loaded for the first time.
    • Subsequent repeated bindings or bindings to other objects will output error prompts at the console.

AngularJS API's Bootstrap launch

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.