AngularJS simple program

After we have opened a project having added AngularJS scripts, its time to Add a new HTML page.


In the new form just give the name of the html page and press OK



A new form will open having some html code

In the html tag add the bellow (in red circle) code. The ng-app piece of code gives to engine to undertand that we  will  use anjularJS


The bellow AngularJS code is a very simple program which create a List for the supermarket.




A directive is an extension of HTML language, which allows us to define new behaviors.
In general every piece of code has the prefix ng- is an AngularJS derecive.

The ng-controller derictive is placed in order to bind the writeAListCtrl controller to the view.
The ng-repeat deractive is used to iterates the Items array
The {{item.kind}} used to display the kind of each item

The result of the code there is the bellow screenshot


Δεν υπάρχουν σχόλια: