Quantcast
Channel: VMware Communities : Discussion List - vSphere Client SDK
Viewing all articles
Browse latest Browse all 2218

Problems with routing in angular2 based plugin with a global view extension

$
0
0

We started migrating the flex plugin and have come till a way where I see my plugin in the admin category and when I click on it it fecthes some data from a backend and displays on our first screen. All this happens angular2 way. We have components and services so far. The next thing is to move to another page on a button click. For that I was exploring Routing in the sample which is part of Fling. Have couple of questions...

1. If I don't have a route for index.html, it cribs. Any obvious reasons?

2. I have the following routes

   const routes: Routes = [

   {path: '', pathMatch: 'full', redirectTo: 'index.html',},

   {path: 'index.html', component: AppComponent},

   {path: 'register', component: UCSDomainRegister}

   ];

AppComponent is my bootstrap component and index.html is my targetviewID in plugin.xml as the target for my icon which goes as a vise.global.views extension.

I have two issues at present.

a. Runtime error - ZoneAwareError {__zone_symbol__error: Error: Uncaught (in promise): Error: Cannot find primary outlet to load 'AppComponent'

b. My router link to register route is not working. I have the following button in my HTML template for the AppComponent.

  <input type="button" class="btn btn-primary" value="Register" routerLink="register" />

Also given is the base href settings as below.

 <script>

         (function(){

            var href = document.location.href;

            href = href.substring(0, href.indexOf("index.html"));

            document.write('<base href="' + href + '" />');

         })();

      </script>

Please let me know if there is a guidelines document which I can follow while developing a H5 plugin based on angular2. Basically how to manipulate the plugin.xml and various routes for the plugin.

Thanks much in anticipation.

Manoj

const routes: Routes = [
   {path: '', pathMatch: 'full', redirectTo: 'index.html',},
   {path: 'index.html', component: AppComponent},
   {path: 'register', component: UCSDomainRegister}
];

Viewing all articles
Browse latest Browse all 2218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>