Angularjs Reload data – update value without page refresh using Angularjs

Angularjs Reload data – update value without page refresh using Angularjs

Refreshable(Reload data) AngularjS service

How to share any state between controllers.
How update/refresh all the state between same controllers.
Angularjs Reload data – update value without page refresh using Angularjs

push the new item into your item after saving

$scope.addnewproduct = function () {
    console.log("Clicked");
    productewAdd.Task_x0020_Type = $scope.mylivewebtype.value;
    productewAdd.Title = $scope.producttitle;
    productewAdd.Body = $scope.pdesc;
    productewAdd.$save(function(){
        $scope.products.push(productewAdd);
      });

  }

How to refresh view without refreshing page in an angularjs app

The $location service:
-Watch simple and observe the any URL.
-Change the your URL.
-Changes the any web address in the simple browser’s(Like as a mozila) address bar.
-Clicks on a simple link in the page.
and alternate matheds “window.location”

READ :  Multiple Image Upload in php with Database

app.controller( 'MainCtrl', function ( $scope,Contact ) {
  $scope.updateContacts = function () {
    Contact.query( function( data ) {
      $scope.contacts = data;
    });
  };

  $scope.save = function( newContact ) {
    Contact.save( newContact, function() {
      $scope.updateContacts();
    });
  };

  // The initial data load
  $scope.updateContacts();  
});

angularjs refresh view after post Example

Relying on using $index from view – side is not safe if any data filters are used in ng-repeat directives.The solution is simple to add an extra new parameter to function $location.path(). “
AngularJS Change Path Without Reloading”

$scope.addType = function () {
    console.log("Clicked");
    typeEntry.Title = $scope.itemtype;
    typeEntry.$save(function () { // Ensure execuation of the save befor reloading the view
        $route.reload();
    });
}

 $scope.addnewproduct = function () {
    console.log("Clicked");
    productewAdd.Task_x0020_Type = $scope.mylivewebtype.value;
    productewAdd.Title = $scope.producttitle;
    productewAdd.Body = $scope.pdesc;
    productewAdd.$save(function () {
        $location.path('/');
    });
}

updating data in angular without refreshing or loading the page Example

<div>
   {{wish.something}}
  <button>Delete</button> 

In controller
--------------
$scope.myliveclick = function(item){
   $http.delete("https://infinityknow.com/myweblist/"+user.nameus +'/' + item.id).then(function(){
     var index = $scope.myweblist.indexOf(item);
     if(index !== -1){
       $scope.myweblist.splice(index,1);
     }
  });    
});

Example

READ :  AngularJS Directive ng-keydown ng-keyup ng-keypress events

Add a Comment

Your email address will not be published. Required fields are marked *