I can not transfer data to angular2 between files.

app.component.ts

import { Component, ViewEncapsulation } from '@angular/core'; import { NewsPostsComponent } from './news/post.component'; @Component({ selector: 'main-app', templateUrl: './app/app.component.html', directives: [NewsPostsComponent] }) export class AppComponent { title: string; posts: string[][]; constructor (){ this.title = 'Journal'; this.posts = [ ['Finish News!', '', '03:49 09.10.2016'], ['Start News', '', '02:49 09.10.2016'], ['Hello World', '', '01:49 09.10.2016'] ]; } } 

post.component.ts

 import { Input, Component } from '@angular/core'; @Component ({ selector: 'news-post', templateUrl: './app/news/post.component.html' }) export class NewsPostsComponent { @Input() posts: string[]; } 

app.component.html

 <news-post [posts]="posts"></news-post> 

Here is an error, help, already rummaged everything. Angular version is the freshest. Here is a mistake

  • What is the version of the angular? directives are sort of outdated and removed - Grundy
  • in AppComponent: posts: string[][]; in the directive posts: string[]; find the difference - Grundy
  • @Grundy is the newest, the one that angular.io . How to fix? - Roman Kravets
  • yeah Seems like a few bugs - Grundy
  • @Grundy imgur.com/a/F7RJ4 , did not help - Roman Kravets

1 answer 1

the directives property of Component has been removed in version rc.6

Instead, you now need to add your components to the declarations section of your NgModule