AngularJS static initialization template details _ AngularJS-js tutorial

Source: Internet
Author: User
This article mainly introduces AngularJS static initialization templates. There are two ways for AngularJS to initialize static templates. One is to use ng-app to automatically initialize modules, or you can use angular. bootstrap (document, [module]) manually starts the application. For more information, see AngularJS. You can use ng-app to automatically initialize the module or angular. bootstrap (document, [module]) manually starts the application. No matter which method is used, after the application is started, the dom elements dynamically added to the dom tree cannot execute angular commands, I cannot bind data and events to the dynamically added dom elements through ng-model or ng-click. What should I do?

It is very common to dynamically add dom elements. For example, you can click the modify user data button on a page to send an ajax request to query user data, then, use the template engine to compile the static template written on the page into an HTML string, and append the HTML string to the page. In general, we will do this:

  Demo  
   
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.