I'm learning Angular and TypeScript and I have a question or two.
With TypeScript can you have one class/object be the variable type for an other object as shown below? If so how do you reference the all of the members using Angular.
/* begin cmsfiles.ts */
export class CMSFiles {
fileID: number;
fileDateTime: Date;
fileName: string;
description: string;
}
/* end cmsfiles.ts */
/* begin news.ts */
import { CMSFiles } from './cmsfiles';
export class News {
newsID: number;
postDateTime: Date;
title: string;
body: string;
file1: CMSFiles;
file2: CMSFiles;
}
/* end news.ts */
In the Angular template I will need to use something like this:
<input [(ngModel)]="news.file1.Title" placeholder="title" />
How can I achieve this?
Title
doesn't exist onCMSFiles
. Did you meanfileName
? – cdbajorin Jan 11 '17 at 19:37