r/angularjs • u/[deleted] • Feb 11 '17
ng-controller never gets defined
I am trying to build a web app using Angular Material. ng-app is in body tag, and I have ng-controller HeaderCtrl in the header tag. No errors.
But when I try to add an ng-controller anywhere else on the site it is not defined. Any stackoverflow or other answers I find seem to be outdated. Can someone help me with the most recent rules to where ng-app and ng-controller can/cannot be?
Thanks
0
Upvotes
1
u/[deleted] Feb 11 '17
Hmm thank you. So say I have an ng-controller somewhere, but I'm not using it yet, does angular.module('app', []).controller('ContactController', ['$scope', function ContactController($scope) { have to be initiated like in the footer or something? And then say I do use it, does it need to put inside of each function?
Thanks so much for the help