com.mattmcfarland.fontawesome icon indicating copy to clipboard operation
com.mattmcfarland.fontawesome copied to clipboard

Alloy.createWidget() Method fails while <Widget /> XML works

Open vitaminrad opened this issue 9 years ago • 4 comments

I've followed the instructions as per the GitHub repo.

Copied com.mattmcfarland.fontawesome to app/widgets/
Added dependencies to config.json

Invoking Alloy.createWidget('com.mattmcfarland.fontawesome'); produces the following error:

[ERROR] :      line = 23;
[ERROR] :      message = "'undefined' is not an object (evaluating 'tag[\"icon\"]')";
[ERROR] :      name = TypeError;
[ERROR] :      sourceId = 261004544;
[ERROR] :      sourceURL = "/alloy/widgets/com.mattmcfarland.fontawesome/controllers/widget.js";

(removed several lines for privacy's sake...)

vitaminrad avatar Sep 24 '14 21:09 vitaminrad

+1 vote

AndrewNatoli avatar Apr 10 '15 22:04 AndrewNatoli

Without too much inspection, the error seems indicative that you do not have any tags with icon attributes in them. If you don't have any at the time you invoke the createWidget method you'll produce an error. You may have to turn instaParse off if you are asynchronously awaiting data before adding icon attributes.

MattMcFarland avatar Sep 08 '15 15:09 MattMcFarland

Hello, I have a parent view with the widget tag which <Require> in Alloy terms another children view Icons are rendered correctly in the child but to change them there is no reference to the $.fa widget of the parent

If I try to disable autoscan with instaParse and try use only the change method the above error popup Currenty I'm setting manually the parent widget refrence to the children

There is a better solution in this case?

Thank you

muka avatar Nov 11 '15 11:11 muka

Working like this:

var fontAwesome = Alloy.createWidget("com.mattmcfarland.fontawesome",{id:"fontAwesome", instaParse :false}); $.window.add(fontAwesome);

var lblTest = Ti.UI.createLabel({ id:"cal", icon:"fa-flag" });

$.container.add(lblTest); fontAwesome.change(lblTest,'fa-calendar');

antoniocanaveral avatar Jun 15 '17 12:06 antoniocanaveral