为什么app.component.html不渲染? [英] Why doesn't app.component.html render?

查看:42
本文介绍了为什么app.component.html不渲染?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下Angular plnkr.co: https://plnkr.co/edit/xA8jU4QYDGxzohNg5NFj?p =预览.

I have the following Angular plnkr.co: https://plnkr.co/edit/xA8jU4QYDGxzohNg5NFj?p=preview.

//app.component.ts

//app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'my-app',
  templateUrl: './app.component.html'
})
export class AppComponent { name = 'Angular'; }

//app.component.html

//app.component.html

testing...
<router-outlet></router-outlet>

浏览器中的opputput是:

The oputput in the browser is:

Loading AppComponent content here ...

为什么看不到app.component.html文件?还是其他问题?

Why doesn't it see the app.component.html file? Or is this some other issue?

推荐答案

尝试这样:

在您的 app.module.ts

import { NgModule, CUSTOM_ELEMENTS_SCHEMA  } from '@angular/core';

@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})

plnkr演示

这篇关于为什么app.component.html不渲染?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆