2
我會得到一個對象的belongsTo關係。什麼是最好的方法?我發現方法'didInsertElement'中的recordingFact對象不是null。我看到了ID。組件承諾不工作
<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
}
})
什麼'recordingFact.get( 'recordsString'),然後(函數(響應){...})'? – claptimes