javascript - Angularjs can't obtain the current state -


i have following in controller:

$scope.state = $state 

if do: console.log($scope.state); - current object inside state tells me information need, including name, url, etc. however, not able grab it...

because if following:

console.log($scope.state.current); console.log(json.stringify($scope.state))); 

i current state:

{name: "", url: "^", views: null, abstract: true} 

does know how can current state's name?

that's because when console log reference. time open object , @ in console it's been filled.

var state = { current: {name: "", url: "^", views: null, abstract: true},  otherdata: [{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}] };  console.log(state); console.log(state.current); console.log(json.stringify(state));  state.current.name = 'something'; 

jsfiddle: https://jsfiddle.net/xfqbc6yr/

in console chrome you'll see object can expand, current state object (where empty) , stringified empty. if expand first object you'll see name has changed 'something'.


Comments