0

http://jsbin.com/vurayayeqa/edit?html,js,output

var app = angular.module('app', []);

app.controller('mainCtrl', function() {
  this.name = 'World';
});

I'm seen in most of the tutorial they do angular.module('app',[]), what does app mean? is it just the name of the module? I've seen in few large project where the name of the module never change, it's always app. I'm confused what is the .module method for.

Second question is why the above example doesn't work with this keyword? it worked if I do

app.controller('mainCtrl', function($scope) {
  $scope.name = 'World';
});

0 Answers0