Injection problem of angular js

0

I have been learning Angular for some time now and having some problems. I try to include a service (httpService), but an error occurs. My code:

Controller.js:

'use strict';

 var app = angular.module('ang-app');
  app.controller('User_Register_EditCtrl', user_register_edit);


  user_register_edit.$inject = ['httpService'];
  function user_register_edit(httpService){

    var ctrl = this;

    //variables


    //methods
    ctrl.backend = backend;
    ctrl.saveUser = saveUser;

    function backend(){
        a = httpService.post('backend.php', {nome: 'carlos', idade: '15'});
        console.log(a);
    }
    function saveUser(){
        $('#loading').show();
        setTimeout(function(){
            console.log('Saving...');
        }, 2000);
    }
}

Service.js:

   'use strict';

 var app = angular.module('ang-app');
 app.factory('httpService', httpService);

function httpService($http, httpUtils){
    var path = './ang-app_webservices';
    var http = {};
    http.get = get;
    http.post = post;

    function get(url, params){
        queryParams = httpUtils.convertToQueryParams(params);
        return $http({
            url: path + url + '?' + queryParams,
            method: 'GET'
        })
    }
    function post(url, data){
        return $http({
            url: path + url,
            method: 'POST',
            data: data
        })
    }
}

The error:

Error: $ injector: unpr Unknown Provider

Unknown provider: httpUtilsProvider

asked by anonymous 30.01.2018 / 21:49

1 answer

0

Meteors, this problem occurs when Angular can not find a provider / service / factory following that message order. In your case starting from link the angle did not find any service / factory called link .

Checks if it exists and is declared by that name.

    
31.01.2018 / 00:38