intel / appframework

The definitive HTML5 mobile javascript framework
http://app-framework-software.intel.com/
MIT License
2.43k stars 882 forks source link

$.afui.loadContent issue #919

Open mrwrighty opened 8 years ago

mrwrighty commented 8 years ago

When trying to load a new page I get the following error:-

Uncaught TypeError: Cannot read property 'loadContent' of undefined (Anonymous Function)

My code is:-

$.afui.loadContent("uib_page_1",false,false,"slide");

Also get error:-

Uncaught TypeError: Cannot read property 'getAttribute' of null appframework.ui.min.js:46 g.load Ajax appframework.ui.min.js:46 g.loadContent appframework.ui.min.js:41 (anonymous function) app.js:98

icrisu commented 8 years ago

I have a similar problem, loadContent does not seem to work properly: $.afui.loadContent('#item'); af.ui.js:983 Uncaught TypeError: from.end(...).run is not a function(…)

the seems to come from line 983-> }).run(transition+"-out");

icrisu commented 8 years ago

I found the solution / workaround for this one, it seems that if you don't pass an anchor param to the loadContent method on line 667 it tries to create an anchor

anchor = anchor || document.createElement("a"); //Hack to allow passing in no anchor

however it fails, so what you need to do is pass the ID of an existing anchor from the dom, or create one than.

Basically you need to do something like:

AppetitMobileApp.prototype.openItem = function(itemID) { $.afui.loadContent("#item", false, false, 'up-reveal', '#test'); };

The last param "#test" is the ID of the anchor.

Cheers!

GitCod-Man commented 8 years ago

@icrisu I have the same problem! but when I pass the ID of an existing anchor and test it , loadContent does not seem to work properly: TypeError: anchor.getAttribute is not a function
var forceRefresh=anchor.getAttribute("data-refresh"); do you have this problem ?

icrisu commented 8 years ago

@GitCod-Man the above has worked for me, sorry I did not have your problem. As I recall I have dynamically created a div with an generated ID, and it worked.