0
votes

Im trying to use Resource in my app and I get the following error:

$injector:unpr "errors.angularjs.org/1.3.15/$injector/unpr?p0=mkResourceProvider%20%3C-%20mkResource%20%3C-%20mkController".

Here is my Code

app

var logApp = angular.module('mkApp', ['ngResource','ngRoute']);

Controller

angular.module('mkApp').controller('mkController', function ($scope, mkResource) {

$scope.ddl = [];

mkResource.LookUp(function (data) {
    $scope.ddl = data;
    console.log($scope.ddl);

});});

Resource

angular.module('mkApp').factory('mkResource', function ($resource, $http) {

var lookup = $resource('api/HowOftens');

function LookUp() {
    return lookup.query();
}

return {
    LookUp: LookUp
}});

HTML

<head>
<script src="../Scripts/angular.min.js"></script>
<script src="../Scripts/jquery-2.1.3.min.js"></script>

<title></title>

<div ng-app="mkApp">
    <div ng-controller="mkController">
        <table>
            <tr>
                <td> F Name</td>
                <td> L Name</td>
            </tr>
            <tr>
                <td><input type="text" /></td>
                <td><input type="text" /></td>
            </tr>
            <tr>
                <td>
                    <slect></slect>
                </td>
            </tr>
        </table>

    </div>
</div>


<script src="MkApp/MkApp.js"></script>
<script src="Controller/MkController.js"></script>

<script src="../Scripts/angular-resource.min.js"></script>    
<script src="../Scripts/angular-route.min.js"></script>

From all the reading ive been doing i understand its injection error. I don't understand what Im not injecting properly though. The final plan was to load ddls from data I will receive.

1
is your code minimized? - Claies
no its all I have, Im trying to rewrite connection from HTTP to resource. I just fixed the error as well. It was the positioning of my references. Thank you though. - kkdeveloper7
Is mkResource in the separate file? - Mary

1 Answers

0
votes

You would need to be loading your angular-route and angular-resource (your libs) before you actually load up your angular app files.