AngularJs маршрутизация с машинописью - PullRequest
0 голосов
/ 11 сентября 2018

Модуль не отображался, когда я использую url http://localhost:8080/#/main или http://localhost:8080/main Что я делаю не так?

app / component / main / Main.Config

mainRoutes.$inject = ['$stateProvider'];
export function mainRoutes($stateProvider: any) {       
   'ngInject'             
    $stateProvider.state('main', {
    url: '/main',        
    component: 'main',
});

app / component / main / Main.module

import * as angular from 'angular';
import uiRouter from '@uirouter/angularjs';
import { mainRoutes } from './main.config';
import { Main } from './main.component';
import { DataManipulationService } from '../../shared/data- 
manipulation/data-manipulation.service';
export const mainModule = angular
.module('app.components.main', [
       uiRouter
])
.component('main', Main)
.service('DataManipulationService', DataManipulationService)
.config(mainRoutes)    
.name; 

app / component / view-info /view-info.config

viewInfoRoutes.$inject = ['$stateProvider'];
export function viewInfoRoutes($stateProvider: any) {
'ngInject'
 $stateProvider.state('viewInfo', {
    url: '/',
    component: 'viewInfo'
});
}

// модуль app / component / view-info / view-info

import * as angular from 'angular';
import uiRouter from '@uirouter/angularjs';
import { viewInfoRoutes } from './view-info.config';
import { ViewInfoComponent } from './viewInfo.compnent';

export const ViewInfoModule = angular
.module('app.components.viewInfo', [      
  uiRouter
])
.component('viewInfo', ViewInfoComponent)
.config(viewInfoRoutes)
.name;

// app / component / index.component.html

<section class="desh-board">
 <side-bar></side-bar>
   <article>
    <my-header></my-header>
    <ui-view></ui-view>     
 </article>
</section>

// app / component / index.module

 import * as angular from 'angular';
 import { SideBarComponent } from './side-bar/sideBar.component';
 import { IndexComponent } from './index.component';
 import { LogoComponent } from './side-bar/logo/logo.component';
 import { NavComponent } from './side-bar/navigation/nav.component';
 import { HeaderComponent } from './header/header.component';
 import { mainModule } from './main/main.module';
 import { ViewInfoModule } from './view-info/view-info.module';

  export const componentsModule = angular
  .module('app.components', [
    mainModule,
    ViewInfoModule      
  ]) 
  .component('index',IndexComponent)
  .component('sideBar', SideBarComponent)
  .component('logo', LogoComponent)
  .component('navigation', NavComponent)   
  .component('myHeader', HeaderComponent)    
  .name;

// app / app.module

 import * as angular from 'angular';
 import uiRouter from '@uirouter/angularjs';

 import { appRoutes } from './app.config';
 import { componentsModule } from './components/index.module';
 import { AppComponent } from './app.component';
 import { appSharedModule } from './shared/shared.module';

 export const root = angular
.module('app', [                    
    componentsModule,
    appSharedModule,
    uiRouter

])
.component('app', AppComponent)
.config(appRoutes)
.name;
...