A service is just a wrapper around an object, so that it can be included in other places. This service has a get method which loads the model from an api.$http is very similar to jquery’sajax function
The controller will call the service to get the model, then expose it on the scope for the view.It also exposes an add function to the view
So let’s get the controller’s scope onto the view. In this example we only have one controller, and we put it’s scope on the document’s whole body so any child can access it.
An important property of scopes, is that they are isolated to their children. This prevents pollution across a large application and it is a key part to the way angular works. For performance, angular only calculates updates to what is on the screen at any time.
Now in the view. We bind to the scope’s add function and inputText….
On the controller we use the todoStorage to load the data, and then set it on the scope.On the view with an ng-repeat we display each todo. Ng-repeat is a directive built into angular that is similar to an ItemTemplate in WPF or Silverlight. The todo is a custom directive.
Directives allow you to teach the browser and html new tricks. And very often you will use directives to create widgets (which are similar to user controls). But there are many other cool things you can do with directives (ng-repeat is a directive).
Getting started with angular
Getting Started with Angularhttps://github.com/jperl/angular-jquery-mobile#getting-started