var app = angular.module('TodoApp', []);
app.controller('TodoCtrl', function($scope){
$scope.todos = ['test'];
$scope.done = function(todo){
var indexOf = $scope.todos.indexOf(todo);
if (indexOf !== -1) {
$scope.todos.splice(indexOf, 1);
}
};
$scope.add = function() {
$scope.todos.push($scope.newTodo);
$scope.newTodo= '';
};
});
I am new to angularjs and writing a simple todo list. I want the the data in $scope.todos to be dynamic so whenever a user moves to another page of my site and returns back he will get the same todos he has entered before. I am thinking of using PHP's session varible to store data into it and pass it to the angular app but I don't know how to do it or maybe this logic is not proper.I am new tho this so any new ideas to this would be awesome.