Angular1 - Language Features Flashcards
URL routing is a popular approach to matching the contents of a URL to specific functionality within a web application.
True
URL routing is a popular approach to matching the contents of a URL to specific functionality within a web application.
True
___ is an example of an element directive
“<mydirective></mydirective>”
Angular doesn’t supply URL routing by default.
True
Once you have a Promise, what can you attach?
finally() method
Like ngBindTemplate, ngBind can have multiple {{ }} Expressions
False
When using a filter with arguments, what is the result of using the following filter? {{1234.5678|number:5}}
1,234.56780 Rounds to 5 places
The directive normalization process strips what from the front of the element?
x- and data-
What are the phases that every module goes through?
config phase, run phase
How can you get the current url from browser?
$location.path()
What does the $locationProvider do?
Helps configure deep linking within the app
You should use the ng-app directive when manually bootstrapping your app.
false
You should use the ng-app directive when manually bootstrapping your app.
false
___ is an example of an element directive
<mydirective></mydirective>
Angular doesn’t supply URL routing by default.
True
Once you have a Promise, what can you attach?
finally() method
Like ngBindTemplate, ngBind can have multiple {{ }} Expressions
False
When using a filter with arguments, what is the result of using the following filter? {{1234.5678|number:5}}
1,234.56780 Rounds to 5 places
Custom Directives Types
- Element - used for UI widgets, restrict: ‘E’
- Attribute - used for mixin behaviors, restrict: ‘A’
What are the phases that every module goes through?
config phase, run phase
How can you get the current url from browser?
$location.path()
What does the $locationProvider do?
Helps configure deep linking within the app
What is the difference between $location and window.location?
$location allows seamless integration with HTML 5 API while window.location does not.
You should use the ng-app directive when manually bootstrapping your app.
false
HTML annotations that trigger JS behaviors
Directives
ng-app
attaches the App Module to a page (root of the app)
ng-controller
attaches a Controller function to the page
ng-model
binds the form element value to the property (i.e. ng-model=“review.stars”)
ng-include
allows us to package a chunk of html and include it in our page fetched via AJAX request) i.e. ng-include = “‘chunk.html’”
Custom Directives
- Register handlers
- Express complex UI
- Call events
- Reuse components
Custom Directives Types
- Element - used for UI widgets, restrict: ‘E’
- Attribute - used for mixin behaviors, restrict: ‘A’
Module
A “container” where all Angular components live
What is an Angular Expression?
How we display values on a page {{values}}
What are Angular expressions evaluated against?
The scope object
What errors will a bad Angular expression give?
They are forgiving and evaluated to null or undefined.
How can you format data in an Angular expression?
Filters
Filter
- denoted by “pipe”
- allows filtering and formatting of data
- {{data | filter:options }}
”@” Directive Bindings
- passing strings
- supports {{}} expressions
- expressions evaluated against directive’s parent scope
”=” Directive Bindings
- two-way model binding
- parent scope linked to model in directive’s isolated scope
“&” Directive Binding
- passing callback method to directive
- method is pre-bound to directive’s parent scope
- call $scope.hello({name:’world’})
Name the three Directive Bindings
- @ string
- = model
- & method
Directives should _____ after themselves. How?
- “clean-up”
- scope.$on($destroy, …);
- forces directive to be destroyed during garbage collection