0

I got this as string: app.model('Categories').findAll(). When I run this 'command' it returns something. How am I able to get the result by running this string?

Thanks

ps, sorry for the bad explanation :S

Bob
  • 873
  • 1
  • 8
  • 21

1 Answers1

-1

I've got it!

eval() is the solution.

So run console.log(eval(app.model('Categories').findAll())) :)

Bob
  • 873
  • 1
  • 8
  • 21
  • eval is usually a bad solution, though :) – kuroi neko Feb 27 '15 at 10:12
  • @kuroineko What would be an alternative to `eval()` – Bob Feb 27 '15 at 10:14
  • http://stackoverflow.com/questions/16037033/alternative-to-eval-javascript Any how in your case you probably get an expression as result. Can you please specify what string you get from `app.model('Categories').findAll()` – Tintu C Raju Feb 27 '15 at 10:16
  • `app.model('Categories').findAll()` is the string itself. It will return an array with objects. The idea is to simulate something like https://docs.angularjs.org/api/ng/directive/ngRepeat – Bob Feb 27 '15 at 10:22