您可以通过使用.decorator
钩上$stateProvider
暴露内部状态的实现。你可以装饰国家建设者的任何财产;我任意选择了“父母”。
app.config(function($stateProvider) {
$stateProvider.decorator('parent', function (internalStateObj, parentFn) {
// This fn is called by StateBuilder each time a state is registered
// The first arg is the internal state. Capture it and add an accessor to public state object.
internalStateObj.self.$$state = function() { return internalStateObj; };
// pass through to default .parent() function
return parentFn(internalStateObj);
});
});
现在,您可以访问使用.$$state()
内部状态的对象,e.gg
var publicState = $state.get("foo");
var privateInternalState = publicState.$$state();
克里斯你是一个芭蕾舞者。非常感谢。 – Derek 2014-11-11 04:50:39