Skip to content

Instantly share code, notes, and snippets.

@Danielkaas94
Last active October 15, 2018 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Danielkaas94/5c1c40ee0e076432f077546b7b73dc4e to your computer and use it in GitHub Desktop.
Save Danielkaas94/5c1c40ee0e076432f077546b7b73dc4e to your computer and use it in GitHub Desktop.
<h1>Hello World 🌍</h1>
<h2>@Outputs() can be a struggle:</h2>
<h3> {{ParentDataObject.name}} </h3>
<h3> {{ParentDataObject.age}} </h3>
<!-- [myAwesomeInputvalue] = @Input('myAwesomeInputvalue') fra child.component.ts -->
<!-- (myOutputValue) = @Output eventEmitter fra child.component.ts -->
<!-- "awesomeMethod($event) = Metode i app.component.ts -->
<app-child [myAwesomeInputvalue]="3+5+7" (myOutputValue)="awesomeMethod($event)"></app-child>
import { Component, ViewChild, Input } from '@angular/core';
import { dataFile } from '../app/models/DataFile';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
ParentDataObject: dataFile;
constructor() {
}
awesomeMethod(ev: dataFile) {
console.log(`got some text: ${ev}`)
console.log(`${ev.name}`)
console.log(`${ev.age}`)
this.ParentDataObject = ev;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment