javascript - Initiating AngularJS -
i'm having issue getting started angularjs. have downloaded minified file , have living in js directory along app.js file. works until try calling app.js file. breaks. here's code.
index.html
<head> <meta charset=utf-8 /> <meta name="description" content="description"> <title>my app</title> <script src="js/angular.min.js"></script> <script src="js/app.js"></script> </head> <body ng-app> <h1>intro data binding</h1> <div ng-controller="dbcontroller"> <input type="text" ng-model="username" /> <p>hello, {{username}}.</p> </div> </body>
app.js
function dbcontroller($scope) { $scope.username; }
on body
tag ng-app="app"
then, in .js file...
angular.module('app', []) .controller("dbcontroller", function($scope){ $scope.username = "my name"; })
it might helpful basic understanding of angular
the angular team provides lot of useful videos , other resources https://docs.angularjs.org/misc/started
free video tutorials: https://www.codeschool.com/courses/shaping-up-with-angular-js
Comments
Post a Comment