Angular controlleras syntax

Descrição

A-Level Angular Notas sobre Angular controlleras syntax, criado por James Drummond em 18-12-2015.
James Drummond
Notas por James Drummond, atualizado more than 1 year ago
James Drummond
Criado por James Drummond quase 9 anos atrás
2
0

Resumo de Recurso

Página 1

The syntax InvoiceController as invoice tells Angular to instantiate the controller and save it in the variable invoice in the current scope.What this means is that you can treat the controller as an object:myApp.controller()You need to be very careful about context: this is what you need to do to use $scope.$watch with this syntax: note binding of thisapp.controller('MainCtrl', function ($scope) { this.title = 'Some title'; // boom $scope.$watch(angular.bind(this, function () { return this.title; // `this` IS the `this` above!! }), function (newVal, oldVal) { // now we will pickup changes to newVal and oldVal }); });

Semelhante

Angular Nuts and Bolts
James Drummond
Angular application scaffolding
James Drummond
Angular-hint
James Drummond
ng-model-options
James Drummond
Architecture and general layout
James Drummond
Quiz - Object Oriented Javascript
arunram.krish
Examen Fundamentos Basicos de Programación
Jose Valderrama0721
Test I. Introduction to web technologies
Angel Martínez Rodriguez
The Princeton Review Chapter 9 Rotational Motion
Anibal Santamaria
Angular
Kingsley Bawuah
JavaScript Fundamentals
Andrew Watters