From c85863b5c4c6f2240ec01776bfaf4c9dd27f9351 Mon Sep 17 00:00:00 2001 From: nelo Date: Thu, 12 Jan 2017 13:09:53 +0100 Subject: [PATCH] =?UTF-8?q?c=C3=B3digo=20para=20capturar=20el=20evento=20d?= =?UTF-8?q?el=20ui-router?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- @salix/crud/src/client/basic-data/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/@salix/crud/src/client/basic-data/index.js b/@salix/crud/src/client/basic-data/index.js index 0231f92d9..5f7622dca 100644 --- a/@salix/crud/src/client/basic-data/index.js +++ b/@salix/crud/src/client/basic-data/index.js @@ -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);