我的 Angularjs-App 未设置查询 url 参数 datenbestand:?datenbestand=undefinded。源代码如下。
HTML
<select ng-model="datenbestand" id="datenbestand" name="datenbestand" class="span3 search-query">
<option value="A">A</option>
<option value="B">B</option>
</select>
控制器
app.controller( 'VListCtrl', [ '$scope', 'personlistdto', 'VListLoader', '$q', 'VService',
function( $scope, personlistdto, VListLoader, $q, VService ) {
$scope.personlistdto = personlistdto;
$scope.searchFactory = VListLoader;
$scope.search = function( ){
$scope.personlistdto = $scope.searchFactory();
};
}
] );
服务:
services.factory( 'VService', [ '$resource',
function find( $resource ) {
return $resource( '/cdemo/rest/vers/ajs/:id',
{ id: '@id', datenbestand: '@datenbestand', isArray: false }
);
} ] );
services.factory( 'VListLoader', [ 'VService', '$q', '$route',
function( VService, $q, $route ) {
var find = function find() {
var delay = $q.defer();
VService.get( function( personlistdto ) {
delay.resolve( personlistdto );
}, function() {
delay.reject( 'Unable to fetch v' );
} );
return delay.promise;
};
return find;
} ] );
我究竟做错了什么?