com.mattmcfarland.fontawesome
com.mattmcfarland.fontawesome copied to clipboard
Alloy.createWidget() Method fails while <Widget /> XML works
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...)
+1 vote
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.
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
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');