Angular reload service when state change or jQuery run for all state (ui.router lib)
<p>I have two issues.
The First one is:
I have try jQuery code and angular.service code for the same thing. To clear input fields from blank spaces dynamically.</p>

<pre><code>$('input[type="text"]').change(function () {
    if (!this.value.replace(/\s/g, '').length) {
        this.value = "";
    }
});
</code></pre>

<p>or </p>

<pre><code>angular.module('app').service('nospace', function () {
$('input[type="text"]').change(function () {
    if (!this.value.replace(/\s/g, '').length) {
        this.value = "";
    }
});
</code></pre>

<p>});</p>

<p>When i try to use jQuery globally for all angular pages is not working. 
When i try to use .service is working, but when i change state is stop working, till i refresh page. I try to add to
 <code>$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {});</code> and call the service from there when state is changed to fix this problem, but still don`t work properly.
I added to controller like this 
<code>angular.module('app').controller('channelAoiEditor', function (..,.., nospace) { ... some code ... }</code></p>

<p>Second issue is with parsing the url to state properly. 
I have this state:</p>

<pre><code>.state('edit', {
      url: '/EditCustomer/:id',
      templateUrl: 'Client/app/customers/editCustomer/editCustomer.html',
      controller: 'editCustomer'
})
</code></pre>

<p>When I'm in "Edit Customer" page and try to change the user directly from the url. Page reload, but retains last used user instead of reloaded the new user, but the URL is the same as new one.
I try with changing the state with:</p>

<pre><code>url: '/EditCustomer/{id}'
or
url: '/EditCustomer/{id:[a-zA-Z0-9/.]*}'
</code></pre>

<p>On <code>$rootScope.$on('$locationChangeSuccess', function (event, url, oldUrl, state, oldState) {..}</code> I get the changes but how to parse it properly to change the content.</p>

<p>Thank You!</p>