我正在显示房间的属性作为我正在处理的房间管理应用程序的一部分,这是输出:

正如你所看到的,Beamer(投影仪的英文版)的价值是"Sony(lamp 01/12/2013)".这个输出是正确的但是当我打开我的控制台时,我看到一些关于插值的错误:

分辨率更高:
"Can't interpolate: {{getBeamerString()}} TypeError: Cannot read property 'aanwezig' of undefined"
Run Code Online (Sandbox Code Playgroud)
这是我的html部分:
<section class="eigenschappen">
<table class="table table-striped table-hover table-bordered">
<thead>
<tr>
<th>Eigenschap</th>
<th>Waarde</th>
<th>Bewerk</th>
</tr>
</thead>
<tbody>
...
<tr>
<td><img class="ruimteNaam" src="../Images/Beamer.png" alt=""/>Beamer</td>
<td>{{getBeamerString()}}</td>
<td><img class="edit" src="../Images/Edit.png" alt=""/></td>
</tr>
...
</tbody>
</table>
</section>
Run Code Online (Sandbox Code Playgroud)
currentRuimte(CurrentRoom in English)是一个范围定义变量,它使用从我的mongoDB获取该数据的资源服务获取其值:
function RuimteController($scope, $routeParams, Ruimte) {
$scope.currentRuimte = Ruimte.get({
ruimteNaam: $routeParams.ruimteNaam
});
$scope.getBeamerString = function () {
var beamer = $scope.currentRuimte.beamer;
if(beamer.aanwezig == 'Ja'){
return beamer.typeBeamer + ' (lamp: ' + beamer.datumLamp …Run Code Online (Sandbox Code Playgroud) angularjs ×1