I am sending a variable to a PHP file as a parameter on a route with AngularJS. The PHP file then returns an array of objects in a Smarty variable that I would like to use in a normal ng-repeat in the new view that is loaded. How can this be accomplished? I have looked into http, resolve, promises, resolve+RequireJS lazy loading. I can not figure out the best way to accomplish this, let alone a way that functions at all. Heck at this point I'd even use a hack if it functioned.
The problem is that in the myProjects
controller, if I define the Smarty variable returned from my PHP file, that data will not be available until AFTER the route with the userId parameter has been called, so it throws an undefined
error and kills the entire script.
Any suggestions very much appreciated!
\$routeProvider
// route for a clients projects
.when('/clientprojects/:userId', {
templateUrl : function(params){ return '/dealer-admin/clients?tpl=true&data='+params.userId; },
controller : 'myProjects'
})