Skip to content

Instantly share code, notes, and snippets.

@yngvebn
Created March 28, 2014 13:53
Show Gist options
  • Save yngvebn/9833312 to your computer and use it in GitHub Desktop.
Save yngvebn/9833312 to your computer and use it in GitHub Desktop.
angular.module('app').controller('HomeCtrl', [function(){
this.name = 'Yngve';
});
// html:
<div ng-controller="HomeCtrl as home">
{{home.name}}
</div>
// vs:
angular.module('app').controller('HomeCtrl', ['$scope', function($scope){
$scope.name = 'Yngve';
});
// html:
<div ng-controller="HomeCtrl">
{{name}}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment