jQueryを介して解析され、オブジェクトにロードされるJSONがいくつかあります$framework
。私は呼び出すことができconsole.log($framework)
、これを返します:
Object
List item
currentPage: Object
hash: ""
path: "/"
routes: Array[3]
url: "http://example.com.dev/"
__proto__: Object
console.log($framework.path)
たとえば、できますが、console.log($framework.currentPage)
またはconsole.log($framework.routes)
常に未定義を返します。コンソールでは、実際に両方を展開して子属性を表示できるため、それらが存在しているように見えます。私は何を間違っていますか?
編集: 要求に応じて、routes 属性で使用している JSON を次に示します。
{
"routes": [
{
"title": "Root",
"path": "/",
"path_plain": "",
"partial": "index",
"container": "#main_content"
},
{
"title": "Content",
"path": "/content",
"path_plain": "content",
"partial": "content/index",
"container": "#main_content"
},
{
"title": "Dashboard",
"path": "/dashboard",
"path_plain": "dashboard",
"partial": "dashboard/index",
"container": "#main_content"
}
]
}
編集:これをさらに詳しく調べた後、本当の原因は、$framework が完全に設定される前に発生していたカスタム コールバックであることが判明しました。属性を直接参照する前と後にコンソールにオブジェクトが表示され、まだ定義されていない理由を説明できませんが、少なくとも解決されました。