2013-11-25 1 views
0

I는 다음과 같습니다 볼 수 있습니다 : 이것은 페이지에 test를 삽입하도록되어Ember.Handlebars.compile 대신 핸들 출력 코드를 반환

App.StarRatingView = Ember.View.extend({ 
    template: function() { 
     return new Ember.Handlebars.compile('test') 
    } 
}) 

을, 대신 그것은 compile() 함수의 정의를 삽입 :

function (context, options) { options = options || {}; var result = templateSpec.call(container, Handlebars, context, options.helpers, options.partials, options.data); var compilerInfo = container.compilerInfo || [], compilerRevision = compilerInfo[0] || 1, currentRevision = Handlebars.COMPILER_REVISION; if (compilerRevision !== currentRevision) { if (compilerRevision < currentRevision) { var runtimeVersions = Handlebars.REVISION_CHANGES[currentRevision], compilerVersions = Handlebars.REVISION_CHANGES[compilerRevision]; throw "Template was precompiled with an older version of Handlebars than the current runtime. "+ "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+")."; } else { // Use the embedded version info since the runtime doesn't know about this revision yet throw "Template was precompiled with a newer version of Handlebars than the current runtime. "+ "Please update your runtime to a newer version ("+compilerInfo[1]+")."; } } return result; } 

왜 그런가?

답변

1

그것은 기능을 기대하지 않는 사용에 .

App.StarRatingView = Ember.View.extend({ 
    templateName: 'test' 
}) 

엠버 지금 주어진 템플릿 이름을 사용하여 뷰를 렌더링이 트릭

App.StarRatingView = Ember.View.extend({ 
    template: Ember.Handlebars.compile('test') 
}) 

또는 더 나은을 수행해야합니다.