Angular controlleras syntax

Descripción

A-Level Angular Apunte sobre Angular controlleras syntax, creado por James Drummond el 18/12/2015.
James Drummond
Apunte por James Drummond, actualizado hace más de 1 año
James Drummond
Creado por James Drummond hace alrededor de 9 años
2
0

Resumen del 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 }); });

Mostrar resumen completo Ocultar resumen completo

Similar

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