Hello.
When you enter a message in the format "# tag message", the message is saved in localStorage
If you enter only one tag, messages associated with this tag must be dynamically counted from localStorage and displayed on the screen (without pressing the button or enter)
I do not know how to solve this problem, guys. I will forgive your help.
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; }); codepen.io/endoneslife/pen/yabwNA