Section 1

Preview this deck

One way scope binding

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

6 years ago

Date created

Mar 14, 2020

Cards (11)

Section 1

(11 cards)

One way scope binding

Front

- pass strings to the attribute (using expressions, {{}})

Back

Link function

Front

- Directive function mainly used for attaching event listeners to DOM elements, watching model properties for changes, and updating the DOM - Extra function for template to modify other items than element content such as css - Ex: <input type="text" ng-model="color" placeholder="Enter a color" /><hello-world/>

Back

Controller function

Front

- used if you want to allow other directives to communicate with yours - - <outer-directive> <inner-directive></inner-directive> </outer-directive>

Back

Two way scope binding

Front

- pass values ranging from simple strings and arrays to complex objects to the isolated scope

Back

Function scope binding

Front

- To refer to functions defined in outer scope we use &

Back

Directives

Front

- Can appear in form of attributes (A), element (E) , Class (C) and or comments (M) - While matching directives, Angular strips the prefix x- or data- from element/attribute names. Then it converts - or : delimited strings to camelCase and matches with the registered directives. - Ex: <x-date-picker></x-date-picker>

Back

Directive properties/configurations

Front

1. Restrict: specifies how a directive should be used. (AECM) 2. Template: specifies the HTML markup that will be produced when the directive is compiled and linked by Angular 3. Replace: specifies if the generated template will replace the HTML element on which the directive is attached

Back

Transclusion

Front

- lets us wrap a directive around arbitrary content - transclude: true - lets us extract a DOM element and put another one inside - transclude: element - includes the element itself in the directive template marked with ng-transclude

Back

Scope binding

Front

- Isolated and parent scope bindings - Binding can be achieved by setting attributes on the directive element in HTML and configuring the scope property in the directive definition object

Back

Directive scopes

Front

- Parent: Default - Child: If the properties and functions you set on the scope are not relevant to other directives and the parent, you should probably create a new child scope. - Isolated: if the directive you are going to build is self contained and reusable. Does not inherit from parent scope, used for private/internal use

Back

Compile function

Front

- Directives like ng-repeat, which need to clone and repeat the DOM element several times, use the compile function before the link function runs

Back