に一つのオブジェクトに関数を適用します:あなたが見ることができるように2角度 - ように私は、それの内部に複数のオブジェクトを持つ「あらゆる」タイプの配列を持つ配列
//List of posts (array)
this.posts = [
//First Post (object)
{
userFirst: 'Teyah',
userLast: 'Tharpe',
postText: 'Good morning, everyone! Have a good day. :)',
//First Post's comments (array)
comments: [
//First Comment (object)
{
cFirstName: 'Jalen',
cLastName: 'Tharpe',
theirComment: 'Thank you'
},
//Second Comment (object)
{
cFirstName: 'Gerald',
cLastName: 'Matthews',
theirComment: 'Thank you! You do the same.'
}
]
},
//Second Post (object)
{
userFirst: 'Jordan',
userLast: 'Gibson',
postText: 'What is the move for today?',
comments: [
{
cFirstName: 'Joshua',
cLastName: 'Stewart',
theirComment: 'Party at my house!!!'
}
]
}
];
、私は配列を持っていますポストオブジェクトの中には、コメントのリストがあります。私はcomment()
関数をオブジェクトの1つに適用しようとしています。言って、posts[0]
。これがAngular 2のスコープ内にあるかどうか誰かに教えてもらえますか?もしそうなら、助けてください。
もっとコードや情報が必要な場合は、私にお知らせください。
ありがとうございます。
何をしますか? –
「コメント()関数を適用する」とはどういう意味ですか? –