angular routing is not working on visual studio cordova
Answers
Answer:
So i've built the default angular cli app. Created:
newroute.component.ts & newroute.component.html
app.component:
<router-outlet></router-outlet>
Created a new route component:
import {NewrouteComponent} from './newroute/newroute.component';
import {ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
export const routes: Routes = [
{ path: '', redirectTo: '/newRoute', pathMatch: 'full' },
{
path: 'newRoute',
component: NewrouteComponent,
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(routes);
Injected that into the module:
@NgModule({
declarations: [
AppComponent,
NewrouteComponent
],
imports: [
BrowserModule,
routing,
ReactiveFormsModule,
FormsModule,
],
providers: [
CordovaService,
DeviceService
],
bootstrap: [AppComponent]
})
export class AppModule {
}
Cordova build:
cordova emulate android
which calls:
ng build --target=production --environment=prod --output-path cordova/www/ --base-href .
Android 6+ works fine and shows the content of the shows, however in Android 5.1.1 the content does not display and in the console i see:
ERROR TypeError: undefined is not a function main.ecb766387713c84cc90f.bundle.js:1 TypeError: undefined is not a function