다른 사람이 개발 한 Angular2
프로젝트가 있는데이를 실행해야합니다. 내가 할 때 npm start
을 사용하면 서버가 실행되지만 my-app
이라는 구성 요소가 페이지에 렌더링되지 않습니다. 구성 요소가 페이지에 표시되지 않습니다.
이
은index.html
입니다 :
이
<html>
<head>
<base href='/'>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<link href="c3.css" rel="stylesheet" type="text/css">
</head>
<body>
<my-app>Loading......</my-app>
</body>
</html>
이 app.components.ts
입니다 :
<div><h1>app components</h1></div>
: 나는 테스트를 위해 간단한
div
을 넣어
app/app.component.html
입니다
my-app
에 대한
template
에서는
import { Component } from '@angular/core';
import { AuthenticationService } from './authentication.service';
import { Router } from '@angular/router';
@Component({
selector: 'my-app',
templateUrl: 'app/app.component.html',
styleUrls: ['app/app.component.css']
})
export class AppComponent {
title = '';
isProd:boolean;
constructor(private authenticationService: AuthenticationService, private router: Router) {
this.isProd = false;
}
이걸 실행할 때 은 index.html
에 있지만 app/app.component.html
의 내용은 볼 수 없습니다.
무엇이 누락 되었습니까?
는 오류 콘솔을 확인합니다. –
c3.css를 찾을 수 없습니다. – Eddy
AuthenticationService 란 무엇입니까? 며칠 전 동일한 문제가 발생하여 @Componet에 제공자를 추가해야했지만 문제가 해결되었습니다 (예 : providers : [AuthenticationService]) –