Hi everybody,
I'm looking at this link
https://github.com/angular/angular.js/issues/1699 but I am not sure I understand it and it's not clear to me if it was implemented already in the latest angularJs or not.
My problem is the Add and creating duplicate pages. Say, I start the page with the following URL
http://siriuswarecontrol.web/SiriuswareControl/Items/DCI#/edit/item/7/54/245I clicked on the Duplicate button that uses the same form but changes isNew property of the scope to true and Save button into Add. After I click on that 'Add' button I am supposed to see new values after Item that correspond to my new Department ID, Category Id, Item Id.
Same thing if I start from the New item creation and then saved it, my url starts from
http://siriuswarecontrol.web/SiriuswareControl/Items/DCI#/new/item/7/54/IZBEEQKSEAQCAIBA/JREVCVKPKIQCAIBAbut after saving should look like the above URL.
So, I suppose I need to do something with the $location.path method but it's not exactly clear to me what should I do in my New method of the controller to properly update the URL.
Can you please clarify that issue for me if it's already implemented or not and what exactly should I do to just update URL but not reload the whole thing?
Thanks in advance.
UPDATE. I think I was able to figure out a solution after reading a few other issues and links. I added this code
services.State.go("editItem",
{
departmentId: data.item.departmeId,
categoryId: data.item.categoryId,
itemId: data.item.itemId
},
{ notify: false, location: "replace" }); // update URL but not re-load
and it seems to do what I needed - the URL is properly updated.
If it's not broken, fix it until it is.
My Blog