{"action":"reopened","issue":{"url":"https://api.github.com/repos/driftyco/ionic/issues/9581","repository_url":"https://api.github.com/repos/driftyco/ionic","labels_url":"https://api.github.com/repos/driftyco/ionic/issues/9581/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic/issues/9581/comments","events_url":"https://api.github.com/repos/driftyco/ionic/issues/9581/events","html_url":"https://github.com/driftyco/ionic/issues/9581","id":194790269,"number":9581,"title":" Ionic V2: No provider for NavController!","user":{"login":"barocsi","id":851560,"avatar_url":"https://avatars.githubusercontent.com/u/851560?v=3","gravatar_id":"","url":"https://api.github.com/users/barocsi","html_url":"https://github.com/barocsi","followers_url":"https://api.github.com/users/barocsi/followers","following_url":"https://api.github.com/users/barocsi/following{/other_user}","gists_url":"https://api.github.com/users/barocsi/gists{/gist_id}","starred_url":"https://api.github.com/users/barocsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barocsi/subscriptions","organizations_url":"https://api.github.com/users/barocsi/orgs","repos_url":"https://api.github.com/users/barocsi/repos","events_url":"https://api.github.com/users/barocsi/events{/privacy}","received_events_url":"https://api.github.com/users/barocsi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-10T20:00:19Z","updated_at":"2016-12-10T20:31:09Z","closed_at":null,"body":"**Ionic version:**  (check one with \"x\")\r\n[ ] **1.x**\r\n[x ] **2.x**\r\n\r\n**I'm submitting a ...**  (check one with \"x\")\r\n[ x] bug report\r\n[ ] feature request\r\n[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/\r\n\r\n**Current behavior:**\r\nInjecting NavController in constructor of service fails with no provider error\r\n\r\n**Expected behavior:**\r\nto work\r\n\r\n**Steps to reproduce:**\r\nThis class throws error (other dep. injection does not throw any error)\r\n```\r\nimport {Interceptor, InterceptedRequest, InterceptedResponse} from 'ng2-interceptors';\r\nimport {NavController, Platform, AlertController} from \"ionic-angular\";\r\nimport {Injectable, Injector} from \"@angular/core\";\r\n\r\n@Injectable()\r\nexport class ServerInterceptorService implements Interceptor {\r\n\r\n  constructor(public platform: Platform,\r\n              public alertCtl: AlertController,\r\n              public navCtl: NavController) {\r\n  }\r\n\r\n  public interceptBefore(request: InterceptedRequest): InterceptedRequest {\r\n    // Do whatever with request: get info or edit it\r\n\r\n    return request;\r\n    /*\r\n     You can return:\r\n     - Request: The modified request\r\n     - Nothing: For convenience: It's just like returning the request\r\n     - <any>(Observable.throw(\"cancelled\")): Cancels the request, interrupting it from the pipeline, and calling back 'interceptAfter' in backwards order of those interceptors that got called up to this point.\r\n     */\r\n  }\r\n\r\n  public interceptAfter(response: InterceptedResponse): InterceptedResponse {\r\n    // Do whatever with response: get info or edit it\r\n    console.log(\"////////////\", response)\r\n    return response;\r\n    /*\r\n     You can return:\r\n     - Response: The modified response\r\n     - Nothing: For convenience: It's just like returning the response\r\n     */\r\n  }\r\n}\r\n```\r\n\r\nand the class above replaces http provider in app.module.ts\r\n```\r\nproviders:[\r\n    ServerInterceptorService,\r\n    {\r\n      provide: Http,\r\n      useFactory: interceptorFactory,\r\n      deps: [XHRBackend, RequestOptions, ServerInterceptorService]\r\n    },\r\n...]\r\n```\r\nOther dependencies are injected properly."}}
{"actor":{"display_login":"barocsi"}}