Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = angular.module('testApp', ["ngStorage"]);
- app.controller('mainCtrl', function($scope,$localStorage){
- if ($localStorage.todoList || []) {
- $scope.todoList = $localStorage.todoList || [];
- $scope.todoMassive = $scope.todoList ;
- }
- $scope.todoAdd = function() {
- var message = $('#message').val();
- var count = message.indexOf(' ');
- var hashtag = message.substring(0, count)
- if(hashtag[0] != '#') hashtag = '#' + hashtag;
- var text = message.substring(count, message.length);
- $scope.todoList.push({
- hashtag:hashtag ,
- todoText:text
- });
- $scope.todoMessage = "";
- $scope.todoHashTag = "";
- $localStorage.todoList = $scope.todoList;
- console.log($scope.todoList);
- };
- $localStorage.todoList = $scope.todoList;
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement