Angular-seed provides an excellent jumping off point for small-largish applications.
Allows for beginners to see some proper file structure and code organization the "Angular way".
Hey! There is some Angular stuff on this page.
I need you to check this out.
<!DOCTYPE html>
<html ng-app>
<head>
<title>My Angular App</title>
</head>
<body>
<h1>My first AngularJS App</h1>
</body>
</html>
Data binding allows you to "marry" to pieces of content together. A change to the view updates the model and a change to the model updates the view.
insanity (in'sanité) :
doing the same thing over and over again and expecting different results.
That is just want the ng-repeat directive allows us to do.
Ng-repeat is a directive that will instantiate a template once per item collection.
This allows for the easy iteration over some data with minimal amount of code.
<li ng-repeat="thing in things">
Do this for all things.
</li>
A controller is used to augment the Angular $scope.
($scope is the glue between application controller and the view.)
A controllers main use is to set up the $scope object or provide behavior to the $scope object.
Do not use to:
<div ng-controller="myController">
Do stuff here.
</div>
myApp.directive('newDirective', function() {
return {
controller: "myController",
}
})
$routeProvider.when('/home', {templateUrl: 'some-template.html', controller: 'myController'});
Allows for useful reusable elements. New directives can be created with classes, attributes, or completely new elements.
Angular comes with several built-in directives like:
ng-model, ng-bind, ng-view.
<twitter-post></twitter-post>
<div class="twitter-post"></div>
<div twitter-post></div>
Sharing is caring.
Routes allow angular to create deep-linking URLs to controllers and views.
Routes can have their own controller and can get parameters from the $routeProvider service.
$routeProvider.when('/issue/:issueId', {templateUrl: 'path/to/template.html', controller: 'myRouteController'});
myControllers.controller('myRouteController', function($scope, $routeParams) {
if ($routeParams.issueId)
$scope.issueId = $routeParams.issueId;
});