Schogini is Magento2 ready. Are you?

Get started with Magento 2 | Need expert Magento2 support?

Getting started with Angular JS


Date: 2015-11-03 | Category: AngularJS

1. Add a reference to AngularJS <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>

Here I have used the CDN URL. You are free to download the library into your folder and include it.

2. Add the ng-app reference.

This will tell AngularJS that this section is an AngularJS app and all the elements inside should be scanned for AngularJS tags. <html ng-app>

3. Use AngularJS directives to add data binding Name: <input type="text" ng-model="customername" />

ng-model will bind the text that you enter in the textbox to the variable customername. Note that, the variable is in the global scope.

Complete Code

In this AngularJS code, whatever you type in the textbox will be displayed in the message in real-time. Try it out and see the power of AngularJS in just a few lines! <!doctype html> <html ng-app> <head> <title>AngularJS Hello World</title> </head> <body> Name: <input type="text" ng-model="namea" /> <br /> Hello, my dear friend ! <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> </body> </html>

Schogini's customer service extends beyond the natural boundaries. ~ Timothy Johnson

Schogini assures 24x7 - 6 hour turn around ticket response time and 24 hour Email response time (support@schogini.com)