I guess 
http://stackoverflow.com/questions/31415052/angular-2-0-router-not-working-on-reloading-the-browser

On Sunday, March 13, 2016 at 5:04:15 PM UTC+1, Tomas Katz wrote:
>
> Im developing an Angular 2 app and all is OK while using the lite-server 
> that is used in the official tutorials in the angular 2 site.
>
> The problem occurs when im loading the app using apache/xamp.
>
> On lite-server:
> The initial page loads the AppComponent and its nested component (Groups) 
> correctly.
>
> On xamp (Apache):
> Everything loads except the contents of router-outlet (Groups)
>
>
>
> The AppComponent view:
>
> <div #header></div>
> <div class="contentWrapper">
>     <div #nav></div>
>     <div class="main">
>         <router-outlet>
>             Loadin...
>         </router-outlet>
>     </div>
> </div>
>
>
> The AppComponent router:
>
>
> import {
>     Component
>     DynamicComponentLoader,
>     ElementRef,
>     OnInit
> } from "angular2/core";
> import {Header} from "../header.component/header.component";
> import {Navigation} from "../navigation.component/navigation.component";
> import {Groups} from "../groups.component/groups.component";
> import {
>     Route,
>     RouteConfig,
>     ROUTER_DIRECTIVES,
>     ROUTER_PROVIDERS
> } from "angular2/router";
>
> @Component({
>     selector:"something-somethig",
>     templateUrl:"app/views/AppComponent.component.html",
>     directives:[
>         ROUTER_DIRECTIVES
>     ],
>     providers:[
>         ROUTER_PROVIDERS
>     ]
> })
> @RouteConfig([
>     {path:"/",name:"Index",component:Groups},
>     {path:"/groups",name:"Groups",component:Groups}
> ])
>
> export class AppComponent implements OnInit{
>     constructor(private _dcl:DynamicComponentLoader,private 
> _elmRef:ElementRef){
>
>     }
>     ngOnInit(){
>         //noinspection TypeScriptValidateTypes
>         this._dcl.loadIntoLocation(Header,this._elmRef,"header");
>         this._dcl.loadIntoLocation(Navigation,this._elmRef,"nav");
>     }
> }
>
>
> Groups HTML:
>
> <div #mainheader></div>
> <div class="row topButtons">
>     <div class="left">
>         <div #groupsactions></div>
>     </div>
>     <div class="right">
>         <div #search></div>
>     </div>
> </div>
> <div #statistics></div>
> <div #datatable></div>
>
>
> Groups component:
>
> /**
>  * Created by Tomas.Katz on 3/10/2016.
>  */
>
> import {
>     Component,
>     OnInit,
>     ElementRef,
>     DynamicComponentLoader
> } from "angular2/core";
>
> import {DataTable} from "../dataTable.component/dataTable.component";
> import {Statistics} from "../statistics.component/statistics.component";
> import {GroupsActions} from 
> "../groupsActions.component/groupsActions.component";
> import {SBoxSearch} from "../search.component/search.component";
> import {MainHeader} from "../mainHeader.component/mainHeader.component";
>
> @Component({
>     selector:"sbox-groups",
>     templateUrl:"app/views/groups.component.html"
> })
>
> export class Groups implements OnInit{
>     constructor(private _dcl:DynamicComponentLoader, private __elmRef
>
> ...

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to