我传递给我的观点两个变量。我怎样才能从角度控制器访问这个变量?访问本地风帆角度变化
帆控制器:
return res.view('dashboard', {
me: {
id: user.id,
apiKey: user.connection.apiKey
}
});
角控制器:
angular.module('DashboardModule').controller('DashboardController', function($scope, $http) {
$http.get("/api/" + encodeURIComponent($scope.me.apiKey));
.success(function(response) {$scope.records = response.records;});
}
});
HTML:
<h5>Api Key:</h5>
<p ng-model="me.apiKey"><%= me.apiKey %></p>
<ul>
<li ng-repeat="x in records">
{{ x.guiLoginName }}
</li>
</ul>
正如你Ç看到我正在尝试执行GET到特定的apiKey这是一个变量。这个变量可以从EJS访问,但不是角度。我究竟做错了什么?公平起见,我基本上不明白帆如何与角度交流...
你发现了一个比检查的答案更好的方式?如果你请发布。谢谢。 –