Last active
September 16, 2016 22:35
-
-
Save ashleyvernon/f879675f1e91745910961c75951d3c45 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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