Skip to content

Instantly share code, notes, and snippets.

@ajspeller
Last active September 1, 2017 13:09
Show Gist options
  • Save ajspeller/17c45ad5a9afb17cacaedb7c2de832d1 to your computer and use it in GitHub Desktop.
Save ajspeller/17c45ad5a9afb17cacaedb7c2de832d1 to your computer and use it in GitHub Desktop.

Revisions

  1. ajspeller revised this gist Sep 1, 2017. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions output
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    on the component
    In the component ...

    @Output() changed = new EventEmitter<Character>();

    @@ -8,4 +8,10 @@ selectedCharacter: Character;
    select(selectedCharacter: Character) {
    this.selectedCharacter = selectedCharacter;
    this.changed.emit(selectedCharacter);
    }
    }

    In the template ...

    <story-characters [storyId]="7"
    (changed)=changed($event)>
    </story-characters>
  2. ajspeller created this gist Sep 1, 2017.
    11 changes: 11 additions & 0 deletions output
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    on the component

    @Output() changed = new EventEmitter<Character>();

    characters: Character[];
    selectedCharacter: Character;

    select(selectedCharacter: Character) {
    this.selectedCharacter = selectedCharacter;
    this.changed.emit(selectedCharacter);
    }