Programmatically generated html code not working. (click)= Pipe Filter Render Event Button
See original GitHub issueI’m submitting a … (check one with “x”)
[x ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
See here for more details: https://forum.ionicframework.com/t/programmatically-generated-html-code-not-working-click-pipe-filter-render-event-button/50783
HTML buttons are created, but onclick event does not get fired. The buttons are in the HTML but there is no click action.
Expected/desired behavior HTML buttons are created, AND onclick event does get fired as in Angular 1.
Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).
What is the expected behavior? HTML buttons are created with onclick events.
What is the motivation / use case for changing the behavior?
It must be possible to create buttons with onclick events on-the-fly reading from an input file JSON. Stream is from well known source (locally). So it is not a security issue. The contents is: “Blabla … (12) … bla bla.”
This should give this output: “Blabla … <button id=“12” (click)=“doAction(‘12’);”>12</button> … bla bla.”
So the only pattern is (n) where n is an integer, whole positive number as in “N”.
Please tell us about your environment:
- Angular version: 2.0.0-beta.25
- Browser: [all ]
- Language: [all ]
Issue Analytics
- State:
- Created 7 years ago
- Comments:29 (12 by maintainers)
@mlc-mlapis write down a solution. “12” is just an example and is variable and comes from the input stream / file locally. So it must be able to SCAN (where “n” is an integer, 1…n)
and transform it to
A solution using Pipe and Directive: Stackoverflow Plunker Demo