var hsbc = angular.module('hsbc',['ngResource','ngRoute']);
hsbc.config ([ '$ routeProvider', '$ locationProvider', function ($ routeProvider, $ locationProvider) {
//console.log('config part working');
$routeProvider
.when('/login', {
controller: 'hsbccontroller',
templateUrl: 'modules/authentication/views/login.html',
hideMenus: true
})
.when('/gloabltranfer', {
controller: 'hsbccontroller',
templateUrl: 'modules/home/views/gloabltranfer.html'
})
.when('/tranferReq', {
controller: 'hsbccontroller',
templateUrl: 'modules/home/views/TransferRquest.html'
})
.when('/reviewdetail', {
controller: 'hsbccontroller',
templateUrl: 'modules/home/views/Reviewdetails.html'
})
.when('/confirmdetail', {
controller: 'hsbccontroller',
templateUrl: 'modules/home/views/confirmdetails.html'
})
.when('/', {
controller: 'hsbccontroller',
templateUrl: 'modules/authentication/views/login.html'
})
.otherwise({ redirectTo: '/login' });
}]). controllore ('hsbccontroller', [ '$ portata', '$ http', '$ risorsa', function ($ portata, $ risorsa, $ http) {
//console.log('controller part working');
$http.get('http://localhost:8080/1/').success(function(data) {
alert(data);
$scope.greeting = data;
});
}]);
I parametri del controller non sono nello stesso ordine in cui sono stati dichiarati utilizzando la notazione array. Cambia la posizione di '$ risorsa' e' $ http'. –
dovrebbe essere .controller ('hsbccontroller', ['$ scope', '$ http', '$ risorsa', funzione ($ scope, $ http, $ risorsa) { – Kop4lyf
Cool, grazie al suo compagno di lavoro. lavorando in angularJs con Rest API. Grazie mille. –