Skip to content
Rob edited this page Jan 19, 2015 · 3 revisions

In Angular 2 you will inject services with type annotations. However since Angular 1 services don't necessarily have types you can use this @InjectNgOne annotation to inject a service by its name.

Example

class MyService {
    constructor(@InjectNgOne('$location') $location) {
        $location.path('https://github.com/robianmcd/angular-next');
    }
}

Clone this wiki locally