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

AngularJS example #6

Closed
simshanith opened this issue Dec 6, 2017 · 1 comment
Closed

AngularJS example #6

simshanith opened this issue Dec 6, 2017 · 1 comment

Comments

@simshanith
Copy link

simshanith commented Dec 6, 2017

Thanks UI router team and @christopherthielen for updating DSR to work with UI-Router 1.x!

I didn't see any note on usage with AngularJS, but this is what I'm using with v1.6:

/**
 * @module $deepStateRedirect
 */

import angular from 'angular';
import uiRouter from '@uirouter/angularjs';
import { DSRPlugin } from '@uirouter/dsr';

export const name = 'ct.ui.router.extras.dsr';

export default angular.module(name, [uiRouter])
	.provider('$deepStateRedirect', $uiRouterProvider => {
		'ngInject';
		const $deepStateRedirect = $uiRouterProvider.plugin(DSRPlugin);
		Object.defineProperty($deepStateRedirect, '$get', {
			value: () => $deepStateRedirect,
		});
		return $deepStateRedirect;
	})
	.config($deepStateRedirectProvider => {
		'ngInject';
	})
	.run($deepStateRedirect => {
		'ngInject';
	})
	.name;

Would be nice to have some documentation (per #5) explaining AngularJS (and other integrations), or even include integrations in this repo.

@christopherthielen
Copy link
Member

Added 3 angularJS examples via fbfa85e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants