2017-07-04 12 views
-1

はここに私のコードです:角度成分がレンダリングされません

import { Component } from '@angular/core'; 
@Component({ 
    selector: 'app-root', 
    templateUrl: './app.component.html', 
    styleUrls: ['../assets/css/app.component.css'] 
}) 
export class MainVisualComponent { 
    main_visual_img:string = ""; 
    main_visual_desc:string = ""; 
    main_visual_title:string = ""; 
    constructor(main_visual_img:string, main_visual_desc:string, main_visual_title:string){ 
    this.main_visual_img = main_visual_img; 
    this.main_visual_desc = main_visual_desc; 
    this.main_visual_title = main_visual_title; 
    } 
} 

HTML:

<section style="text-align:center"> 
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> 
    <visual-item></visual-item> 
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> 
    </a> 
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> 
    </a> 
    </div> 
</section> 
+0

'templateUrl: './app.component.html'、 styleUrls:[」../assets/css/app .component.css '] 'それらのパスはindex.htmlフォルダからの相対パスでなければなりません。クイックスタートまたはng-cliプロジェクトを使用する場合は、ほとんどの場合アプリフォルダです。したがって、それは 'app/app.component.html'などでなければなりません。 – Gary

答えて

0

コンポーネントのセレクタがapp-rootです。

<visual-item></visual-item><app-root></app-root>に置き換えてください。

ので、あなたのコードは次のようになります。 - >テンプレートバインディング問題

<section style="text-align:center"> 
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"> 
    <app-root></app-root> 
    <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev"> 
    </a> 
    <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next"> 
    </a> 
    </div> 
</section> 
+0

それ以外のコンポーネントは、 –

+0

はindex.html –

0

それはちょうどコンポーネント<ました。

は動作しません:

<aria-selected="{{first}}" aria-hidden="{{last}}" aria-controls="SliderItem0{{i+1}}" data-target="#carousel-example-generic" data-slide-to="{{i}}"> 

作品:

<[attr.aria-selected]="first" [attr.aria-controls]="'SliderItem0'+(i+1)" data-target="#carousel-example-generic" [attr.data-slide-to]="i"> 
+0

@thirtydotありがとう –

関連する問題