I have an app which uses the selector portfolio-app
and has 2 stylesheets - '../app/styles/templateMobile.css', '../app/styles/templateOther.css'
Now when I open my app from the default URL (localhost:3000 ATM), the stylesheets get applied properly. But when I go to a different route, and press refresh (F5), the template styles are not applied to the page. The same thing happens when I start on a different route.
There are no error messages in the console.
I tested this in firefox, chrome and safari, incognito mode and with clearing the browser cache. I also tested on a LG G2, iPhone, iPad and various android emulators (Nexus 9, Nexus 10, Galaxy Nexus). All the time the result is the same.
app.component:
import { Component } from 'angular2/core';
import {ViewEncapsulation} from 'angular2/core';
import { ROUTER_PROVIDERS, ROUTER_DIRECTIVES, RouteConfig } from 'angular2/router';
import { LandingComponent } from './landing.component';
import { PortfolioComponent } from './portfolio.component';
import { PagesService } from './pages.service';
@Component({
selector: 'portfolio-app',
templateUrl: '/app/views/template.html',
styleUrls: ['../app/styles/templateMobile.css', '../app/styles/templateOther.css'],
encapsulation: ViewEncapsulation.None,
directives: [ROUTER_DIRECTIVES],
providers: [ROUTER_PROVIDERS, PagesService]
})
@RouteConfig([
{ path: '/landing', name: 'Landing', component: LandingComponent, useAsDefault: true },
{ path: '/portfolio', name: 'Portfolio', component: PortfolioComponent }
])
export class AppComponent {
landing = true;
portfolio = false;
changeMiniNavLanding = function () {
this.landing = true;
this.portfolio = false;
}
changeMiniNavPortfolio = function () {
this.landing = false;
this.portfolio = true;
}
}
main.ts :
import {bootstrap} from 'angular2/platform/browser';
import {AppComponent} from './app.component';
bootstrap(AppComponent);
If you need additional information, please ask, or browse trough the gitHub repository. (all relevant files are in the app folder).
Thanks for the help.