Advertisement
desdemona

app.js

Dec 17th, 2014
468
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function () {
  2.     var app = angular.module('taskManager', []);
  3.  
  4.  
  5.     //var store = this;
  6.     //store.products = [];
  7.     //$http.get('/products.json').success(function (data) {
  8.     //    store.products = data;
  9.     //});
  10.     app.controller('TaskManagerController', ['$http',function($http) {
  11.         //this.task = tasks;
  12.         this.newTask = {};
  13.  
  14.         var manager = this;
  15.         manager.task = [];
  16.         $http.get('http://127.0.0.1:8081/tasks.json').success(function (data) {
  17.             manager.task = data;
  18.         });
  19.  
  20.         this.addNewTask = function ()
  21.         {
  22.             tasks.push(this.newTask);
  23.             this.newTask = {};
  24.         };
  25.     }]);
  26.  
  27.     app.controller('PanelController', function () {
  28.         this.tab = 1;
  29.         this.selectTab = function (setTab) {
  30.             this.tab = setTab;
  31.         };
  32.         this.isSelected = function (checkTab) {
  33.             return this.tab === checkTab;
  34.         };
  35.     });
  36.     app.directive('taskDescription', function () {
  37.         return {
  38.             restrict: 'E', //element czyli tag, dyrektywa
  39.             templateUrl: 'task-description.html'
  40.         };
  41.     });
  42.  
  43.  
  44.     var tasks = [
  45.         {
  46.             name: 'feed dog',
  47.             time: '1388123412323',
  48.             description: ' Fido is hungry',
  49.             done: false,
  50.             disabled: false
  51.         },
  52.  
  53.         {
  54.             name: 'do dishes',
  55.             time: '1389123412323',
  56.             description: '. . .',
  57.             done: false,
  58.             disabled: false
  59.         }
  60.     ];
  61.  
  62. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement