What Is Directives?
Directives is use in HTML tags you are seeing ng-app, ng-model, ng-bind that is an all Angular directive. I will define some use full directive.
- ng-app initialize the angularjs app it's place on tag. ng-app tell you this is angularjs app.
- ng-init This directive use to initialize the application data.
- ng-model this directive use to binds value of the Html controls like (input, select, textarea) etc.
Directive Expressions and data bind |
What Is Expression?
Expressions are really cool because if I wanted to put “2 + 2” and try to write out the result I could do that. You can’t put conditional logic in here because you shouldn’t be putting that type of conditional logic in your views.
What Is Data Binding?
Data binding is use to any value to synchronize and show the result with out refreshing the web page. For example if you want to show your name when you write in text box just you make the ng-model="nameModel" within input text box tag then you will bind the tag like ng-bind="nameModel" within p paragraph tag. We are also use data bind through expression.
What Is Filters?
Now we learn how to make filters in angularjs first we will be made one array and we will be made two objects within array now lets start.
Example |
Example two |
What is ng-repead Directive?
We are using another directive ng-repeate, this directive is use to get the values from array and objects. You are seeing nam in names In this case “nam” is not the same thing as I just demonstrated: “nam” is just a variable. If i put
“foo” here then i would bind to “foo” here.
Out put |