diff --git a/my-todolist/.gitignore b/my-todolist/.gitignore index debc15c..0bf4790 100644 --- a/my-todolist/.gitignore +++ b/my-todolist/.gitignore @@ -2,4 +2,5 @@ node_modules/ .idea -uploads + +uploads/ diff --git a/my-todolist/js/MainController.js b/my-todolist/js/MainController.js index b1d5d88..83fe6d6 100644 --- a/my-todolist/js/MainController.js +++ b/my-todolist/js/MainController.js @@ -3,16 +3,64 @@ */ function MainController($scope){ + this.likelist=[]; + this.myAmount=209.82; + this.myDate=1288323623006; + this.text="the text is here"; + this.myarray=[ + "angular","app" + ]; + this.addMovie=function(){ + this.favourites.unshift({ + title:this.newtitle, + year:this.release + } + ) + }; + this.unlike= function(index){ + this.likelist.splice(index,1); + }; + this.myObject={ + one:"key1", + two:"key2" + }; + this.addToLikes=function(movie) + { +// in function + this.likelist.push(movie); + }; this.favourites=[{ title:'the shawshank', year:'1994', popular:true },{ - title:'the shawshank', - year:'1994', + title:'excorcist', + year:'1995', popular:false }] } +function UserController($http){ +var API='/api/todo'; +this.userId=''; +this.chosenUser={}; +this.getUser=function(){ + if(!this.userId){ + return; + } + $http.get(API+this.userId); + $http.then(function(response){ + this.chosenUser=response.data; + console.log(this.chosenUser) + },function(reason){ +console.log(reason) + }); + $http.post() +} +} + + angular.module('app1') - .controller('MainController',MainController) \ No newline at end of file + .controller('MainController',MainController) +angular.module('app2') + .controller('UserController',UserController) \ No newline at end of file diff --git a/my-todolist/js/app.js b/my-todolist/js/app.js index b3c724f..a38e782 100644 --- a/my-todolist/js/app.js +++ b/my-todolist/js/app.js @@ -1,4 +1,5 @@ /** * Created by lcom64 on 30/1/17. */ -angular.module('app1',[]); \ No newline at end of file +angular.module('app1',[]); +angular.module('app2',[]); \ No newline at end of file diff --git a/my-todolist/js/app2.js b/my-todolist/js/app2.js new file mode 100644 index 0000000..e69de29 diff --git a/my-todolist/js/index1.html b/my-todolist/js/index1.html index 2e21e93..6a0c9f8 100644 --- a/my-todolist/js/index1.html +++ b/my-todolist/js/index1.html @@ -6,11 +6,60 @@
+ + +{{main.myObject|json}}
+ Year
+ Title
+ the movie is popular
- +{{user.chosenUser}}
+