AngularJS is a MVC – Model View Controller framework i recommended in my previous post. Here i’,m going to go through the basics of Angular as well provide you with challenges and examples. Warning! this is not a full introduction to angular, here i just explain some nifty features to get you exited and show you some examples. Hope you enjoy!
Angular, what is it?
Angular is framework used to write main table dynamic organized web applications. In your HTML you sprinkle what is called directives on your html tags. A directive is simply attributes Angular has defined that you place in your tags. The framework provides you with cool features that allow you to create structured web apps and single page applications(SPA). go to Angularjs.org to see how to get started and install it.
Directives and angular defined attributes that you place in your tags. Which your angular uses to manipulate the html page.There are many directives that come with angular like ng-app, ng-repeat, ng-model. you need ng-app to include this as some container element in your application in order for it to work with angular. later i will show you a simple example with ng-model.
A controller is something you define in your JS files. you attach it to the DOM – Document Object Model by including the ng-controller directive on a container element. When you want to pass data to the DOM via the ng-controller directive you include the scope object in your controller.
The $scope is what allows us to communicate data from the controller to the dom. in this example the myCtrl controller stores a greeting in $scope. The container element that carries the controller tag with a value of myCtrl now has access to the greeting variable.
a): What does MVC stand for?
b): What does the scope object do?
c): What is an expression?
d): what is a directive?
Thank you for reading! i hope you enjoyed this short intro. But this is by no means a comprehensive guide. I made this to get you exited about the cool features and get you interested in the framework. To read more go to their website.