Skip to content

Instantly share code, notes, and snippets.

@ngohungphuc
Created August 2, 2019 08:39
Show Gist options
  • Select an option

  • Save ngohungphuc/6dbf2eec14da6e6fb3aa6d460e069c3a to your computer and use it in GitHub Desktop.

Select an option

Save ngohungphuc/6dbf2eec14da6e6fb3aa6d460e069c3a to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
name = 'Angular';
data = {
firstname: 'tony'
};
onClick() {
this.data.firstname = 'hudson'; // this not work
//below work
this.data = {
firstname: 'hudson'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment