I want to use a service only for first time launch of application in a device. After that i want to use localStorage for data changes n all. Is their any function by which I can call a service only once to store data in localStorage ? I don’t want to run this service again.
Ex code
app.controller(‘TodoCtrl’, function($scope,$http,$state, $stateParams,$filter) {
$http.get('js/data.json').success (function(data){
window.localStorage['post'] = JSON.stringify(data);
$scope.tasks = JSON.parse(window.localStorage['post']);