Regarding #4: Make separate controllers for every distinct part of your page, and if two or more controllers need to share data, use Factories and or Services.
Regarding #8: When you get to building larger apps, you will surely want to write modules this way:
So, with multiple controllers as long as I pass $scope to each controller then the scope variables are shared?
My problem with creating a controller the way you detailed in "Regarding #8:", is that upon initial page load the console reports that there is no controller available to the app.
So I create my controller the old fashioned way we created JavaScript functions/objects:
function myController($scope, $timeout, datasource){ /* code here */ }
Comment
Regarding #4:
Make separate controllers for every distinct part of your page, and if two or more controllers need to share data, use Factories and or Services.
Regarding #8:
When you get to building larger apps, you will surely want to write modules this way:
angular.module('namespace.modulename', [])
.controller('SomeCtrl', ['$scope', 'SomeFactoryOrService', function($scope, SomeFactoryOrService) {
}])
.controller(...)
.controller(...)
;
Then you will find it is easiest to put the dependencies-as-strings list in the call to controller().
Replies
So, with multiple controllers as long as I pass $scope to each controller then the scope variables are shared?
My problem with creating a controller the way you detailed in "Regarding #8:", is that upon initial page load the console reports that there is no controller available to the app.
So I create my controller the old fashioned way we created JavaScript functions/objects:
function myController($scope, $timeout, datasource){
/* code here */
}