Getting Started with AngularJS Cheatsheet

Add Angular / Bower to App
bower init
bower install –save angularjs

.gitignore
node_modules
bower_components

Load Angular in index.html
<!-- Load Angular & index.js -->
<script src="/angular/angular.min.js"></script>
<script src="/index.js"></script>

<!—- Bind HTML document to Angular —->
<html lang="en" ng-app="MyApp">
<body ng-controller="MyCtrl as myCtrl">
Add in main Node.js file
app.use(
    express.static(__dirname + "/bower_components")
);
Template for Angular, index.js
(function() {
    var MyApp = angular.module("MyApp", []);

    var MyCtrl = function() {
        var myCtrl = this;

// this is a form with name, email inputs & submit button
        myCtrl.email = "";
        myCtrl.name = "";
        myCtrl.submit = function() {
           console.log("processing form for " + myCtrl.name);
         }
    };

    MyApp.controller("MyCtrl", MyCtrl);
})();
Install Bootstrap
bower install –save bootstrap


Load Order
bootstrap.css
jquery.js
bootstrap.js
angular.js

Leave a Reply

Your email address will not be published. Required fields are marked *