6

I would like to use the $models object while hacking javascript in the Google Chrome Console .

For example, I would like a 1 line sample of how to get the $models object and then be able to : $models.getItem("tcm:1-42")

4
  • sorry robrtc, unable to understand the question. if you execute above line directly in chrome console, it works fine.
    – Raj Kumar
    Commented Dec 19, 2014 at 6:55
  • I get this error: ReferenceError: $models is not defined. I want to be able to load the selected item in the GUI into an object.
    – robrtc
    Commented Dec 19, 2014 at 6:58
  • $models works fine for me in Tridion 2011SP1 env and shows following Object {getOwningWindow: function, getModelFactory: function, getItem: function, createNewItem: function, getItemType: function…}
    – Raj Kumar
    Commented Dec 19, 2014 at 7:01
  • Maybe changed in 2013SP1 with the new Anguilla updates?
    – robrtc
    Commented Dec 19, 2014 at 7:07

1 Answer 1

9

You need to ensure that you have first selected the correct frame in the console. It defaults to 'top frame' but you'll want to choose e.g. Dashboard.aspx. You'll know it's the right one when it helps you with code completion :)

Correct frame selected

2
  • Thanks Peter...the hack-ish way to get it in Chrome is window.top.frames[1].$models...
    – robrtc
    Commented Dec 19, 2014 at 9:40
  • Very helpful, I was turning crazy trying to get the user in the tridion 2013 dashboard, using the js console in chrome. Commented Apr 22, 2015 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.