opitzconsulting / jquery-mobile-angular-adapter

jquery mobile angular adapter
MIT License
517 stars 114 forks source link

Append pages dynamically #149

Closed avandijk closed 11 years ago

avandijk commented 11 years ago

hi,

I've a index.html which has a static logon page and corresponding controller. Now, when I click the logon button, I want to append some html (several jqm pages) to the body and bind those pages to a few angular controllers.

See http://jsfiddle.net/avandijk/SuFwQ/1/

But after I append the html and compile the html (using bootstrap on the new pages) the $location.url command doesn't work...

$(document.body).append(html);//append dynamic html (normally, comes from server via ajax) angular.bootstrap($('#menu,#form1'), ['ngm']);//compile dynamic html to angular $location.routeOverride({ locals: { p: { viewinfo: 'test' } }, onActivate: 'load(p)' }); //change page to menu $location.url('#menu');

Maybe I'm doing something wrong....

tbosch commented 11 years ago

Hi, you shouldn't use angular.bootstrap twice, but $compile when you compile your newly appended pages. Here is a corrected jsfiddle: http://jsfiddle.net/SuFwQ/3/

And you may also remove the remaining angular.bootstrap from your js code and use the ng-app="ngm" directive on the <body> tag...

Closing this, as it's no bug... Tobias

avandijk commented 11 years ago

works like a charm!!! Thanks again Tobias...