Tuesday, 11 October 2016

Angular JS - Study Guide


Here are the things to learn if you are interested in Angular JS:

Some Useful Angular Directives:

ngDisabled
ngChecked
ngMultiple
ngReadonly
ngSelected
ngForm
ngSubmit
ngHref
ngSrc
ngNonBindable
ng-pluralize

IE Restriction (Be mindful of the older IEs)

  • You will have to use ployfill JSON.stringify
  • Do not use Angular Tags (It can be used as class, tags, attribute)


Expressions:
ex; {{expression}}  Not all JS Functions are supported like MATH library functions.

Filters:
Modifying Output
Formatting
Sorting Dataset
Filtering Dataset
{{  expression | filter }}

Built-In Filters
uppercase
lowercase
{{ 22/7 |  number : 2 }}
{{ 100.10 |  currency }}
date
json

"Used with ng-repeat"
orderBy
limitTo
filter

  • Is Angular filters case-sensitive?

        Yes.

  • What happens if anything is wrong with the anyone of the directive on the page?

            It breaks all the other directive bindings, resulting in showing angular tags
             "{{ some  expression }}" in HTML.


Writing Custom Filters
<module_name>.filter( 'name_of_the_filter', function()
{
     return function('model_name_or_input_param', ['Optional_any_additional_param'])
{
     return 'SomethingNew';
}
}

Ex;
myModule.filter( 'getLength', function()
{
     return function(firstName)
{
     return firstName.length;
}
}
























No comments:

Post a Comment