Error: No provider for OnsNavigator!



  • When using ons-navigator inside ons-splitter provide below error
    0_1478944406782_upload-33775fb8-c31b-4f9b-a2e1-89022abc9f56

    my source is below

    1. boot.ts :
      0_1478944545161_upload-15606aeb-24ac-4e3c-b021-256b75cc5ff5
    2. app.component.ts
      0_1478944598198_upload-44409890-c13c-4255-844e-3efd63b43a58
    3. splitside.component.ts
      0_1478944675244_upload-0816fb6e-a87b-45c0-91e9-06dd166a4de6
    4. sidecontent.component.ts
      0_1478944717987_upload-9d1df7b1-8861-478c-86f4-1e51f0ccfcb6
    5. splitcontentpage1.component.ts
      0_1478944764804_upload-50cef58c-ec8e-4eb3-8bfe-c5bfe0604b8f
    6. splitcontentpage2.component.ts
      0_1478944809170_upload-e145cb1b-46f8-40d8-b844-d7de1a6cf638

    please advice how to fix the problem. possible give us sample

    thanks
    kasim



  • @kasim This example is for vanilla and I don’t know Angular 2 well enough to chime it, but maybe it will point you in the right direction. http://tutorial.onsen.io/?framework=vanilla&category=Community tutorials&module=splitter_navigator



  • @kasim Did you ever resolve this? I am running into similar issues with OnsNavigator and I’m not sure what I’m doing wrong.

    Thanks.


  • Onsen UI

    Hi, @kasim!

    I have checked your code.
    SidePageComponent seems to try to inject an OnsNavigator instance, but the ancestor components of SidePageComponent have no ons-navigator in their templates.
    So the hierarchical dependency injector of Angular could not find a corresponding provider for OnsNavigator instance which registered in ContentPageComponent and reported the error like No provider for OnsNavigator.

    You can fix this problem by connecting SidePageComponent with ContentPageComponent via a service.

    The official guide for Angular component interaction is here:
    https://angular.io/docs/ts/latest/cookbook/component-communication.html


Log in to reply