Open juranoac opened 11 years ago
Hi, controllers for views work a little different in the adapter compared to plain angular. E.g. the adapter caches the views and their controllers for performance reasons, plain angular always recreates the views. For details see the Readme.md.
In total, you have to add the controller to the view that you want to use (with ng-controller
) and remove the controller
entry from your route.
I leave this ticket open to investigate if we could support the normal angular way of defining controllers for views on routes, though it will be a bit complicated...
Thanks, Tobias
I'm incredibly skeptic about adding this as a dependancy for a project I'm starting on, because of the lack of support for template
& controller
, as well as ng-view
.
Can you elaborate on why this is necessary?
You're rewriting core Angular APIs.
Hi, for ngView see #59. Basically, ngView does not create the right markup for jQuery Mobile, and it always recompiles the pages, which is not optimal regarding performance.
For template: We are using jQuery Mobile to load and change between pages. So instead of template
just use an embedded page.
For controller: You are right, we could also support them. However, as we are not using ngView
we need to manually add support for them.
Hope this helps, Tobias
Hi, I'm getting this error on Chrome's console:
Uncaught Error: Controllers are not allowed on routes with the jqm adapter. However, you may use the onActivate parameter from project (file angular.min.js, line 26).
I'm tryng to pass this example: http://angularjs.org/#wire-up-a-backend to JQM 1.3.1, adding the angular adapter in this order on the html head: JQuery 1.9.1 / JQM 1.3.1 / AngularJS 1.0.6 / AngularJS Resource / Angular Adapter (min) / project.js and mongo.js (custom scripts).