index.html
<doctype html> <html ng-app="main"> <head></head> <body ng-controller="mainController"> <button ng-click="log()">Log</button> <script type="text/javascript" src="angular.min.js"></script> <script type="text/javascript" src="main.js"></script> </body> </html>
main.js
var main = angular.module('main', []); main.controller('mainController', function($scope) { $scope.log = function() { console.log('Logging a simple message...'); } });
You can easily see which names map to which implementation, e.g.
ng-app="main"
is angular.module('main', []);
, so on and so fourth.Note: It is extremely important to invoke angular.module with the second argument (in this case, the empty array), otherwise, it is not going to work.
Angular 5 Resources
ReplyDeleteThanks for your post. I’ve been thinking about writing a very comparable post over the last couple of weeks, I’ll probably keep it short and sweet and link to this instead if thats cool. Thanks. custom pool builder spicewood tx
ReplyDelete