angular.module("quickquiz-builder").service("SettingsService", function ($http, $q) {
var self = {
'generalSettings': [],
'getGeneralSettings' : function(){
var d = $q.defer();
$http({
url: "get.php",
method: "GET"
}).then(function successCallback(resonse) {
var config = resonse.data.config;
config = JSON.parse(config).data;
self.generalSettings = config.settings;
d.resolve();
}, function errorCallback(response) {
console.dir(response);
});
d.promise();
}
}
}), angular.module("quickquiz-builder").directive("quizbuilderSettings", ["SettingsService", "QuestionsService", "$filter", function (a, b, c) {
return {
restrict: "E",
scope: {},
templateUrl: "templates/settings.html",
controllerAs: "ctrl",
controller: ["$scope", function (c) {
a.getGeneralSettings().then(function success(data){
console.dir(data);
});
}]
}
}])
<div ng-app="quickquiz-builder">
<div ng-view></div>
</div>
The code does not executes. I get error 'getGeneraSettings' function not found when i call it from injected service inside directive. I am newbie in angular, any help will be a great appreciation.
