Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Output event in components not working

$
0
0

@rodrigoreal wrote:

Well, im trying to have an output event with my components, but i cant put it to work.

Here is the essencial part of my code:

rune-simulator.ts:

@Component({
  templateUrl: "app/components/rune-simulator/rune-simulator.html",
  selector: 'rune-simulator',
  directives: [MonsterInfoComponent]
})

export class RuneSimulator {
  constructor(){

  }

  onUpdate(value) {
    console.log(value);
  }
}

rune-simulator.html

<monster-info (monsterstars) = "onUpdate($event)" > </monster-info>

monster-info.ts

@Component({
  templateUrl: "app/components/monster-info/monster-info.html",
  selector: 'monster-info'
})

export class MonsterInfoComponent {
  @Output() monsterstars = new EventEmitter();

  onChangedMonsterStars(value) {
    console.info("mi", value);
    this.monsterstars.next(value);
  }
}

monster-info.html

<img (click)="onChangedMonsterStars(2)">

I have some input working with they, but i didnt put it here because i dont think it is necessary, but i cant put the output to work.

Anyone have any idea?
Thanks

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>