100%(1)1 out of 1 people found this document helpful
This preview shows page 5 - 8 out of 18 pages.
What are the key differences between AngularJS and jQuery?
AngularJS Extends HTMLAngularJS extends HTML with ng-directives.The ng-appdirective defines an AngularJS application.The ng-modeldirective binds the value of HTML controls (input, select, textarea) to application data.The ng-binddirective binds application data to the HTML view. AngularJS Example<!DOCTYPE html><html><body><div ng-app=""><p>Name: <input type="text" ng-model="name"></p><p ng-bind="name"></p></div><script src=""></script></body></html>Example explained:AngularJS starts automatically when the web page has loaded.The ng-appdirective tells AngularJS that the <div> element is the "owner" of an AngularJS application.The ng-modeldirective binds the value of the input field to the application variable name.The ng-binddirective binds the innerHTMLof the <p> element to the application variable name. You can use data-ng-, instead of ng-, if you want to make your page HTML5 valid. AngularJS DirectivesAs you have already seen, AngularJS directives are HTML attributes with an ngprefix.The ng-initdirective initialize AngularJS application variables.AngularJS Example<div ng-app="" ng-init="firstName='John'"><p>The name is <span ng-bind="firstName"></span></p>
</div> AngularJS ControllersAngularJS applications are controlled by controllers. The ng-controllerdirective defines the controller.The controller code will execute when the page loads.AngularJS Example<div ng-app="" ng-controller="personController">
Want to read all 18 pages?
Want to read all 18 pages?
You've reached the end of your free preview.
Want to read all 18 pages?
Summer '14
Document Object Model, AngularJS, AngularJS Example