Bonjour
J'ai l'erreur
Error: [$injector:unpr] http://errors.angularjs.org/1.2.14/$injector/unpr?p0=%24resourceProvider%20%3C-%20%24resource%20%3C-%20UserService2
at angular.js:36
Mais mon UserService2 me semble bien defini ?
Ou est mon erreur ?
Code HTML : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65 <!DOCTYPE html> <html> <head> <title>Auto Complete Test</title> <link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script> <script type="text/javascript"> var app = angular.module('mainApp', []); <!-- http://localhost:8080/RESTfulExample05/select3.html --> // Factory app.factory('UserService2', function($resource) { return $resource('http://localhost:8080/RESTfulExample05/library/getallbook', {}, { query2: { method: 'GET', transformResponse: function(data) { return angular.fromJson(data).book; }, isArray: true } }); }); // Controller app.controller('search2Controller', function($scope, UserService2){ $scope.search2 = {'book': []}; UserService2.query2().$promise.then(function(data) { $scope.search2 = data; $scope.isArray = data instanceof Array; }); }); </script> </head> <body ng-app="mainApp"> <br> <div ng-controller="search2Controller"> <br> Avec le Nom <br> <select ng-model="selectedCar2" ng-options="product as product.isbn for product in search2.book"> </select> <h2>Model: {{selectedCar2.title}}</h2> </div> </body> </html>
Merci
Partager