Skip to content

Instantly share code, notes, and snippets.

@ashleyvernon
Last active September 16, 2016 22:35
Show Gist options
  • Save ashleyvernon/f879675f1e91745910961c75951d3c45 to your computer and use it in GitHub Desktop.
Save ashleyvernon/f879675f1e91745910961c75951d3c45 to your computer and use it in GitHub Desktop.
Creating an App using Angular
Step 1.index.html ng-app html tag:
example:
<html lang="en" ng-app="appName">\
Step 2. Define your controllers in app.js.
example:
angular
.module('appName',[])
.controller('appController', appController);
function AlbumsIndexController() {
var vm = this;
vm.thing = {};
vm.func = function(){};
// more logic here
}
To use your controllers in the View declare them in index.html:
example:
<div ng-controller="AlbumsIndexController as albumsIndexCtrl">
<!--placeholder for now-->
</div>
Step 3. use ng-model in your index.html.
example:
<div ng-controller="SampleCtrl">
<span>Enter your name:</span>
<input type="text" ng-model="myName">
<h1>{{ myName }}</h1>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment