2012-07-14 66 views
1

我剛從this jsfiddle更新到EmberJS的版本。Emberjs最新版本與路由器錯誤:沒有方法'finishPartial'

控制器/視圖:

App = Em.Application.create(); 

// Instantiated and wired up for you in App.initialize() 
App.ApplicationController = Em.Controller.extend(); 
App.ApplicationView = Em.View.extend({ 
    templateName: 'application' 
}); 
App.NavbarController = Em.Controller.extend(); 
App.NavbarView = Em.View.extend({ 
    templateName: 'navbar' 
}); 
// Your stuff 
App.HomeController = Em.Controller.extend({}); 
App.HomeView = Em.View.extend({ 
    templateName: 'home' 
}); 

App.ProfileController = Em.Controller.extend({}); 
App.ProfileView = Em.View.extend({ 
    templateName: 'profile' 
}); 

// Nested views in the profile 
App.PostsController = Em.Controller.extend({}); 
App.PostsView = Em.View.extend({ 
    templateName: 'posts' 
}); 

App.PhotosController = Em.Controller.extend({}); 
App.PhotosView = Em.View.extend({ 
    templateName: 'photos' 
}); 

我一直在使用新的路由器,但得到一些怪異的行爲,並希望能更新可能會整理出來,不幸的是我現在得到以下警告和錯誤:

WARNING: Computed properties will soon be cacheable by default. To enable this in your app, set ENV.CP_DEFAULT_CACHEABLE = true. vendor.js:54720 
Uncaught TypeError: Object function() { return initMixin(this, arguments); } has no method 'finishPartial' vendor.js:42905 

任何人有任何線索可能會在這裏?

+0

使用控制檯的堆棧跟蹤找到你的代碼觸發錯誤的行。發佈代碼和堆棧跟蹤。 – 2012-07-14 22:37:59

+0

Hey Zack,錯誤來自Ember庫,很難說它來自哪裏,因爲我所有的js都被編譯成一個大的vendor.js文件。這是它跌倒的方法: 'Ember.Mixin.finishPartial(this);' 讓我知道你是否需要我得到更詳細的東西。謝謝你的幫助。 – 2012-07-15 16:18:54

回答

2

以您的jsfiddle爲起點,我唯一的錯誤是使用Em.State而不是Em.Route來定義路由器。

使用最新版本的燼,你必須使用Em.Route。

+0

這麼晚纔回到這個版本,不過謝天謝地,這似乎已經通過一次燼更新來解決了。謝謝你們的幫助。 – 2012-08-25 19:06:46

0

的錯誤表明您的代碼試圖調用一個函數的方法時,你應該在函數的結果來操作..的如myFunction.finishPartial();代替myFunction().finishParital();

快速谷歌爲Em.Mixin導致我提出這個大膽猜測:

Em.Mixin.create().finishPartial(this)

相關問題