código para capturar el evento del ui-router

This commit is contained in:
nelo 2017-01-12 13:09:53 +01:00
parent 017c0caf7e
commit c85863b5c4
1 changed files with 9 additions and 6 deletions

View File

@ -8,18 +8,21 @@ export const COMPONENT = {
bindings: {
client: '<'
},
controller: function($http, $rootScope, copyObject, equalsObject) {
controller: function($http, $rootScope, copyObject, equalsObject, $state) {
this.currentstate = $state.current;
var self = this;
this.$onChanges = function (changes) {
if(this.client)
this.clientOld = copyObject(this.client);
}
/*$rootScope.$on("$locationChangeStart", function(event) {
if(!equalsObject(this.client, this.clientOld)){
$rootScope.$on("$stateChangeStart", function(event, next) {
//if(!equalsObject(self.client, self.clientOld)){
event.preventDefault();
}
});*/
//}
});
$http.get('/client/api/SalesPeople').then(
json => this.sales = json.data,
@ -37,5 +40,5 @@ export const COMPONENT = {
};
}
};
COMPONENT.controller.$inject = ['$http', '$rootScope', 'copyObject', 'equalsObject'];
COMPONENT.controller.$inject = ['$http', '$rootScope', 'copyObject', 'equalsObject', '$state'];
module.component(NAME, COMPONENT);