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
[php]
$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);
});
}
[/php]
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”
[php]
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();
});
[/php]
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”
[php]
$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(‘/’);
});
}
[/php]
updating data in angular without refreshing or loading the page Example
[php]
In controller
————–
$scope.myliveclick = function(item){
$http.delete(“http://infinityknow.com/myweblist/”+user.nameus +’/’ + item.id).then(function(){
var index = $scope.myweblist.indexOf(item);
if(index !== -1){
$scope.myweblist.splice(index,1);
}
});
});
[/php]