Which one is better? Why?
(function(){
var app = angular.module('myApp', []);
app.controller('MyController', function() {
this.guy = obj1;
});
app.controller('AnotherController', function ($scope){
$scope.guy = obj2;
});
var obj1 = {
'name' : 'david',
'title' : 'dude from obj1',
'company' : 'AA',
'doesIt' : 'this uses this'
}, obj2 = {
'name' : 'warren',
'title' : 'dude from obj2',
'company' : 'AA',
'doesIt' : 'this uses scope'
};
})();
I've seen tutorials that use both. Is this a preference thing? Is it just whether to be able to use the controller alias in the html attr or not? What's so great about $scope? I'm looking for a straight forward answer. Thanks.