Last active
October 15, 2018 09:57
-
-
Save Danielkaas94/5c1c40ee0e076432f077546b7b73dc4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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