Reputation: 53
I'm sending values from the HTML page into TS component without using form, I got an a build error when I try npm run build, here is my sample:
I have no problem using >npm run dev or >ng build But when I build it for production, it will through an error using
npm run build
src\app\messages\messages-new\messages-new.component.html(52,22): : Property 'messageTitle' does not exist on type 'MessagesNewComponent'.
HTML:
<input matInput placeholder="Type a title" name="messageTitle" [(ngModel)]="messageTitle">
<button class="simple-form-button" color="primary" mat-raised-button type="submit" value="submit" (click)="sendMessage(messageTitle)">
<mat-icon>send</mat-icon> Send
</button>
Upvotes: 1
Views: 5033
Reputation: 222522
Which means you need to declare the variable in your component.ts
messageTitle : string;
Upvotes: 1