var myApp = angular.module('myApp', []); myApp.controller('MyCtrl', myController); function myController() { this.myObject = {}; this.myObject.var1 = "text1"; this.myObject.var2 = "text2"; }; /* The Other way to do it is, writng the following code in the browser developer console: angular.element($('#main')).scope() */
<div id="main" ng-controller="MyCtrl as vm"> <div>One way to achieve it</div> <div>{{vm | json}}</div> <br/> </div>