Skip to main content

Posts

Showing posts from August, 2014

angular in 10 steps

So, how to quick start with angular? For example, you need some kind of shopping cart. Here is step by step tutorial: 1. Create app/app.js file - this is our main module. var shoppingCart = angular.module('shoppingCart',['ngRoute']); 2. Then you can configure your routes: shoppingCart.config(['$routeProvider', function($routeProvider){     $routeProvider.when('/',{        templateUrl: 'app/views/home.html', //path to our view        controller: 'productController' //page controller     });     $routeProvider.otherwise({ redirectTo: '/' }); }]); 3. Create service (app/services/productService.js) which will deliver data into your app. shoppingCart.factory('productService',function($http){     return {         getAll: function(){             return $http({"method": "GET", "url": "app/data/data.json"}); /*also you can path here more parameters like data etc*/