Closed crmolinaz closed 8 years ago
It's possible to add dynamically elements. It was added some versions ago.
Can you reproduce or explain what you're trying to do ?
Hello,
I have the same problem when using http.get to assign values to it. The return value for http.get is JSON object. When i directly assign it hardcoded, it works well, just when assign after i get return data from http.get is failed.
The error caught is as shown below TypeError: Cannot read property 'length' of undefined
Thanks & Regards, Kevin M.
Are you using the latest version ? This issue was fixed a couple of versions ago. Can you build an example ? Or send me some sort of code snippet so I can have a look ?
imported files
i pull it via bower, should be latest 1?
How i call the API and assign value $http.get("http://www.myapi.com/myapi.aspx") .success(function(response) { $scope.imenu = response; });
The frontend
It should. Just to be sure, check in the package.json if the "version": "0.1.8" if not, update it
hello, yeah it is 0.1.8, i wonder what's the problem, the item can be in JSON object format right?
can you provide me the code for ionic view example? let me fork it so i can learn from it.
Thank you very much for your time
hello,
I think i've made it. I'm able to dynamically set the value in. What changes i've made is simply declare the variable as object before assign it.
Thank you for your time and effort. Kevin Mun
Can you share your solution ? (Just so others can see it if in the future they have the same issue)
Hello,
yes of course.
need to declare the variable as object before assign value to it. $scope.imenu = [];
$http.get(http://www.myapi.com/myapi.aspx) .success(function(response) { $scope.imenu = response; });
Thanks & Regards, Kevin Mun
Makes sense. Was passing an undefined scope variable to the directive. Thanks
When I tried to add dynamically elements, failed because the library does not support it.
I tried to fix but does not work even using $scope.$apply to reload.
Any idea?