Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 新建角度项目如何设置主页_Html_Angular_Typescript - Fatal编程技术网

Html 新建角度项目如何设置主页

Html 新建角度项目如何设置主页,html,angular,typescript,Html,Angular,Typescript,我是新手 我已使用此链接创建了新项目https://cli.angular.io/ 这里显示的主页来自appcomponent.html 我已经在SRC>>pages>>index.html和index.ts中创建了新页面 我在appcomponent.ts和appmodule.ts 如何将默认主页设置为索引 这是我的应用程序组件页面 import { Component } from '@angular/core'; import { Http, Headers } from '@angula

我是新手

我已使用此链接创建了新项目
https://cli.angular.io/

这里显示的主页来自
appcomponent.html

我已经在SRC>>pages>>index.html和index.ts中创建了新页面

我在
appcomponent.ts
appmodule.ts

如何将默认主页设置为索引

这是我的应用程序组件页面

import { Component } from '@angular/core';
import { Http, Headers } from '@angular/http';
import { IndexPage } from '../pages/index';


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class MyApp {
  title = 'app';
  rootPage:any = IndexPage;


  constructor(    public http: Http ) {

    }
  }

您必须使用ng g c MyComponent生成一个新组件。然后加上
到您的app.component.html文件。最后,您必须将路由器配置为在主地址(localhost:4200)显示此组件。对象应该是

const routesConfig: Routes = [
    { path: '',     component: MyComponent}
    ]

阅读app-rounting.module.ts中有关路由器和路由的更多信息

{path: "",  component: DashboardComponent, pathMatch: "full"},

为什么棱角如此神秘?