Writing instruction templates in Angularjs

Source: Internet
Author: User
Tags event listener

1Angular.module (' ModuleName ', []). Directive (2' Namespacedirectivename ',3[function() {4             return {5Restrict: ",//describes how directives are used in templates, including element e, attributes a,css style classes, annotations, or any of the above6priority:0,//sets the order in which directives are executed in the template, in order relative to other directives7Template: ",//writes an inline template as a string, which is ignored if the template is provided as a URL8Templateurl: ",//describes the URLs required to load the template. This property is ignored if the template is provided in temlate form9Replace:true,//if set to True, replace the element that contains the directive, or append it to the inside of the elementTenTransclude:true,//move the original child node of the instruction element into a new template interior OneScope: ' bool or object ',//creates a new scope for the current instruction, rather than inheriting it from the parent scope AConstroller:function($scope, $element, $attrs, $transclude) { -                     //Create a controller that exposes an API that can communicate between multiple instructions using this API -                 }, theRequire: ",//requires that another instruction must exist for the current instruction to execute -Link:function(Scope, ielement, iattrs) { -                     //programmatically modifies an instance of the resulting DOM element, adds an event listener, and sets the data binding -                 }, +Compile:function(TElement, Tattrs, transclude) { -                     //you can use Ng-repeat to programmatically modify the DOM template to implement an instruction that spans multiple instructions.  +                     //You can also return a link function, which you can use to modify an example of the resulting element A                     return { atPre:functionprelink (Scope, ielement, Iattrs, - Controller) { -                         }, -Post:functionPostlink (Scope, ielement, Iattrs, - Controller) { -                         } in  -                     } to                 } +             }; -} ]);

Writing instruction templates in Angularjs

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.