angular-css icon indicating copy to clipboard operation
angular-css copied to clipboard

Its not working with state provider

Open alimalik91 opened this issue 9 years ago • 3 comments

Hi,

I added this in my angularjs app, used in a state. In the state, provided the css. But it is loaded in all of the (unrelated) states, instead of just the requisite state.

alimalik91 avatar Jan 27 '16 10:01 alimalik91

Can you provide a code sample of your index.html, app.js, etc.?

scottux avatar Feb 09 '16 21:02 scottux

Yes, a plunker would help.

alexcastillo avatar Apr 07 '16 14:04 alexcastillo

This has probably nothing to do with the issue of alimalik91. But I can confirm that angular-css doesn't work with the latest version of ui-router. (because of the deprecated $stateChangeSuccess event on the $rootScope)

You could workaround this issue by manually broadcasting a rootScope event:

angular
    .module('app')
    .run(['$rootScope', '$transitions', ($rootScope, $transitions) => {
      $transitions.onSuccess({}, transition => {
        // Backwards compatible UI Router
        $rootScope.$broadcast('$stateChangeSuccess', transition.to(), transition.params(), transition.from(), transition.params(), transition.options());
      });
    }]);

cwouter avatar Feb 13 '17 07:02 cwouter