Are there any Typescript definitions for the AngularJS ui-router?
-
26-12-2019 - |
Question
I am using typescript with ui-router. Has anyone found any Typescript definitions for this. I looked on definately typed and could see nothing. Here is what I would like to find an interface file for:
$stateProvider
Solution
We are using this d.ts for ui-router
:
Updated link, May - 2015
https://github.com/borisyankov/DefinitelyTyped/blob/master/angular-ui-router/angular-ui-router.d.ts
raw version (ready for copy/paste)
UPGRADE Notes:
When I updated angular-ui-router.d.ts
to the latest (May 2015) version, I also faced few build issues. Solution in a nutshell was
- angular definition was converted
- from:
declare module ng {
- into:
declare module angular {
- so update
angular.d.ts
to the latest version- updated all related (existing)
d.ts
as well (angular-animate.d.ts, angular-sanitize.d.ts...)- change all other
(custom)
modules declarations like
declare module ng.XXX {
intodeclare module angular.XXX {
With these few steps... all should be working again (original, not working link)
small code snippet form that resources:
// Type definitions for Angular JS 1.1.5+ (ui.router module)
// Project: https://github.com/angular-ui/ui-router
// Definitions by: Michel Salib <https://github.com/michelsalib>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
declare module ng.ui {
interface IState {
...
The example of usage
module MyModule
{
export class MyStateConfig
{
constructor(private $stateProvider: ng.ui.IStateProvider
, private $urlRouterProvider: ng.ui.IUrlRouterProvider
...)
{
this.$stateProvider.state(...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow