Error: SyntaxError: Unexpected strict mode reserved word(…)..

angular, typescript

Solution

The problem is that you are declaring the Message class with parentheses after its name `()`:

export class Message(){

You may change the message.model.ts to:

message.model.ts

import { Component } from '@angular/core';

export class Message{
    constructor(public content: string){}
}

Problem

app.template.html ``` <div class="container"> <div class="row"> <div class="col-md-6 "> <button class= "btn btn-primary" (click)="onAddMessage()">RANDOM BUTTON</button> </div> </div> </div> <div class="container"> <div class="row"> <div class="col-md-6 "> <article class="panel panel-default" *ngFor = "let latestmessage of messages" > <div class="panel-body"> {{ latestmessage.content }} </div> </article> </div> </div> </div> ``` app.component.ts ``` import { Component } from '@angular/core'; import { Message } from './message.model'; @Component({ moduleId: module.id, selector: 'my-app', templateUrl: 'app.template.html' }) export class AppComponent { messages: Message[] = [ new Message('hello') ]; onAddMessage() { const rnd = Math.ceil(Math.random() * 100); const msg = new Message(rnd + ' is a awsome number'); this.messages.push(msg); } } ``` message.model.ts ``` import { Component } from '@angular/core'; export class Message(){ constructor(public content: string){} } ``` This code is build in angularjs2 and nodejs .I created a button.when i click on button it give me response like this hello 99 number is an awesome number.what is reserved word in this code?? anyone can help??

Original source