In the \"Create Components\" section of AngularJS\'s homepage, there is this example:
controller: function($scope, $element) {
var panes = $scope.panes = [
$scope has a different 'this' then the controller 'this'.Thus if you put a console.log(this) inside controller it gives you a object(controller) and this.addPane() adds addPane Method to the controller Object. But the $scope has different scope and all method in its scope need to be accesed by $scope.methodName().
this.methodName()
inside controller means to add methos inside controller object.$scope.functionName()
is in HTML and inside
$scope.functionName(){
this.name="Name";
//or
$scope.myname="myname"//are same}
Paste this code in your editor and open console to see...
this $sope vs controller
Comming From $SCOPE :{{firstName}}
Comming from $SCOPE:{{lastName}}
Should Come From Controller:{{nickName}}
Blank nickName is because nickName is attached to
'this' of controller.
{{message}}