わからないいただきました!これで間違っているが、私は生命維持の閉じ括弧を指しているブラウザでこのエラーを取得しておきます。私のAjax呼び出しは、サーバー側から大きなJSONを返します。どんな助けもありがとうございます。AngularJSにSyntaxError:期待される表現、得た「)」
(function() {
'use strict';
angular.module('MenuCategoriesApp', [])
.controller ('MenuCategoriesController', MenuCategoriesController)
.service('MenuCategoriesService', MenuCategoriesService)
.constant('ApiBasePath', "http://sacchis-restaurant.herokuapp.com");
MenuCategoriesController.$inject = ['MenuCategoriesService'];
function MenuCategoriesController (MenuCategoriesService) {
var menu = this;
menu.logMenuItems = function (shortName) {
var promise = MenuCategoriesService.getMenuForCategories(shortName);
promise.then(function (response) {
menu.categories = response.data;
}).
catch(function(){
menu.errorText = 'something went terribly wrong!!'
});
};
MenuCategoriesService.$inject = ['$http', 'ApiBasePath'];
function MenuCategoriesService($http, ApiBasePath) {
var service = this;
service.getMenuForCategories = function (shortName) {
var response = $http({
method: "GET",
url: (ApiBasePath + "/menu_items.json"),
params : {
category : shortName
}
});
return response;
};
};
})();
あなたには余分な '};'があります。 – Pointy