0
ページの読み込み時にデータベースからコンボボックスにデータを入力しようとしています。私がそれをデバッグすると、デバッグポイントはadminsService.test(結果)にまったくヒットしません。何故ですか?私は条件なしでデータを取得しようとしています。サービスで角度コンポーネントからデータベースにアクセス
angular.module('adminService', []).factory('adminService', function ($rootScope, $http) {
var modelService = function() {
}
modelService.prototype.test = function (test) {
var promise = $http(
{
method: 'POST',
url: '/Model/getTopics',
contentType: 'application/json',
data: {
test: test
}
});
return promise;
}
viewRoleModule.controller('viewRoleController', function ($scope, $routeParams, adminService) {
var self = this;
self.$onInit = function() {
self.topicRoleItems = function()
{
adminService.test(result);
};
}
});
<div ng-repeat="item in $ctrl.topicRoleItems">
{{item.TopicName}}
</div>
を試してみていることをありがとう、私はエラーを取得しています:adminService.testが機能 – user6440175
アップデートを試してみてくださいではありません。 –