Sunday, 26 October 2014

angularjs creates custom elements(tag) 1


customized element:


js file for it:

this templateUrl links to a html file, it will be used to render the customized element:


Or just put the html into this js file with url.

This renderer will use the default scope which is the parent scope.

So by default all renderer are using the same scope. If a binding changed all bindings will be changed.

Below is a way to create a scope:





to pass data to renderer:


a way to handle the passed data:


you can use @ = and &. If the parameter name is same, then just @, = and & will be ok.

In html, the value name (html tag attribute) should be like abc-ccc or my-name. and in the renderer, it should be "@myName".













No comments:

Post a comment