Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble using angularjs + npm + scripts solution #175

Closed
manishb-socialcurry opened this issue Oct 2, 2018 · 1 comment
Closed

Trouble using angularjs + npm + scripts solution #175

manishb-socialcurry opened this issue Oct 2, 2018 · 1 comment
Labels

Comments

@manishb-socialcurry
Copy link

  1. Hit npm install @uirouter/core @uirouter/sticky-states @uirouter/angularjs.
  2. Copy ui-router-core[.min].js, ui-router-sticks-states[.min].js and ui-router-angularjs[.min].js to a directory where you can load it from, e.g. your dist directory.
  3. Include the scripts in your index.html:
<script src="/deps/angular-ui-router/release/ui-router-core.js"></script>
<script src="/deps/angular-ui-router/release/ui-router-sticky-states.js"></script>
<script src="/deps/angular-ui-router/release/ui-router-angularjs.js"></script>
  1. Add the following code to your app.module.js (or similar):
angular.module('app.state', ['ui.router']).config([
  '$uiRouterProvider',
  function($uiRouterProvider) {
    var StickyStates = window['@uirouter/sticky-states'];
    $uiRouterProvider.plugin(StickyStates.StickyStatesPlugin);
  }
]);

Originally posted by @molehillrocker in #4 (comment)

I tried this solution. It somehow did not work for me. Sticky states did not work as expected. I then printed out the variable StickyStates which prints an empty object "{ }" and when I print out StickyStates.StickyStatesPlugin, it tells me that it is undefined!

Where am I making a mistake?

Here is the stub from my index.html:

` <script src="scripts/plugins/angular-ui-router/release/ui-router-core.min.js" ></script>

<script src="scripts/plugins/angular-ui-router/release/ui-router-sticky-states.js" ></script> <script src="scripts/plugins/angular-ui-router/release/ui-router-dsr.min.js" ></script> <script src="scripts/plugins/angular-ui-router/release/ui-router-angularjs.js" ></script> <script src="scripts/plugins/angular-ui-router/release/angular-ui-router.min.js" ></script> <script src="scripts/plugins/angular-ui-router/release/resolveService.min.js" ></script> <script src="scripts/plugins/angular-ui-router/release/stateEvents.min.js" ></script>

`

And, here is my app.js:

.config(['$uiRouterProvider', function($uiRouterProvider) { var StickyStates = window['@uirouter/sticky-states']; console.log("StickyStates: " + JSON.stringify(StickyStates)); console.log("StickyStatesPlugin: " + JSON.stringify(StickyStates.StickyStatesPlugin)); $uiRouterProvider.plugin(StickyStatesPlugin); }]);

Please help.

@stale
Copy link

stale bot commented Apr 30, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

This does not mean that the issue is invalid. Valid issues may be reopened.

Thank you for your contributions.

@stale stale bot added the stale label Apr 30, 2020
@stale stale bot closed this as completed May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant