Téléchargement

Intégration HTML:

<html ng-app='App'>
  <head>
    <script src='/javascripts/angular.js'></script>
    <script src='/javascripts/angular-resource.js'></script>
    <script src='/javascripts/angular-route.js'></script>
    <script src='/javascripts/app.js'></script>

Intégration Jade:

html(ng-app='App')
  head
    script(src='/javascripts/angular.js')
    script(src='/javascripts/angular-resource.js')
    script(src='/javascripts/angular-route.js')
    script(src='/javascripts/app.js')

Code (app.js)

var app = angular.module('App', ['ngRoute']); // meme attribut que ng-app.

API

AngularModule angular.module(String ngAppValue, Array dependencies)

AngularModule.config(Array params)
  params: list of ['$dependecy1', '$dependecy2'] and end callback when they are ready
  callback: function($dependecy1, $dependency2) {}

AngularModule.controller('ControllerName', params)
  params like: [$scope, $resource, ...]

Dependicies: 
 'ngRoute'
    Provides: '$routeProvider'
 'ngResource'
    Provides: $resource

Autres:
  $scope
    $scope.var
  $location
    $location.path(String url)

// note that templateUrl is loaded in div with ng-view
$routeProvider $routeProvider.when(String path, { 
   templateUrl: String urlToDownload 
   controller: String controllerName // see AngularModule.controller
})
$routeProvider $routeProvider.otherwise({redirectTo: String url })

<div ng-view=""ng-view></div>



resourceInstance = $resource(url)
resourceInstance.query(function(objectFromURL) {
  $scope.variable = [];
})

// injection des variables de scope dans les balises html avec ng-repeat:
<li ng-repeat="variable in variables">{{variable.property}}</li>

// injection de variable dans un champ input
$scope.variable = {bla:1}
<input ng-model="variable.bla"/>

// évènement click
$scope.maFonction = function() {}
<input type="button" value="Click Me" ng-click="maFonction()"/>