我会得到一个对象的belongsTo关系。什么是最好的方法?我看到方法'didInsertElement'中的recordingFact对象不是null。我看到了身份。
<script type="text/x-handlebars" data-template-name="alerts/alert">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
<i class="glyphicon glyphicon-flash"></i>
Alert
</h3>
</div>
<div class="panel-body">
{{alert-chart recordingFact=model.recordingFact}}
</div>
</div>
</script>
App.AlertChartComponent = Ember.Component.extend({
recordingFact: null,
didInsertElement: function(){
var recordingFact = this.get('recordingFact');
// if I do some code with promise like .then(function(response){...})
// I get the error recordingFact has no method then
//
var data = recordingFact.get('recordsString'); // I get undefined
}
})
答案 0 :(得分:0)
它对我有用,你确定你传递了一个承诺,或者你确定该模型上存在该属性吗?
您可以将其注销以查看
<div class="panel-body">
{{log model.recordingFact}}
{{alert-chart recordingFact=model.recordingFact}}
</div>