Hello everyone!
I’m enjoying the Ionic2 and is wonderful.
I need to build a page with the components dynamically.
Example:
getting the json will add components such as ion-label, ion-button, ion-checkbox, etc.
So ride the component tree with events depending on the business logic.
What better way to do this?
This link is broken:
in this page
I don’t understand all of this topic but I try tu use the DOM. When i load a component of a checkbox for example, i get a simple HTML checkbox not the ionic checkbox.
Could you give me a sample example of a checkbox component and the call of this component if you think that’s possible. Or help me to find the right way.
Thanks in advance.
Especially with ahead-of-time template compilation right around the corner, I would suggest rethinking your design so that you don’t need to be doing this at all.
I understand,
but my project has dynamic formularies,
that users do create in the system.
I read from json/xml for to create formulary.
may be Dynamic forms will help you
basically you need to create a template for each control and inject it in a general way
a lot of fun this… thanks, is working!
Now I am trying to make include code from string:
Ex:
@Compone …
export class MyPage {
engine: Engine;
constructor(...){
this.engine = new Engine();
testClick(){
var code = "(function (){ return engine.testRule() )}())";
var result = eval.call(null, code);
console.log(result);
}
}
class Engine {
testRule(){
return “asdasd”;
}
}
give a error: “engine not defined”.
Any suggestion?
May i know why you want this kind of workout?
probably, you can use an interface for this type of workout,
please elaborate your need, i will try my best
ok… thank you! great!
working!
Any security consideration gone through your mind using eval?
1 Like
I used Function instead eval.
let func:Function = new Function(‘engine’, ’ your code here ');
let engine = new Engine();
let exec = func(engine)();
1 Like