Currently, I am not in the process of developing a full-fledged application. Instead, my focus is on understanding HTTP requests using Angular.
Below is a snippet of my simple (albeit poorly written) HTML template:
<div class="row-fluid" ng-controller="SearchCtrl">
<div>zip: {{zip}}</div>
<div>id: {{appid}}</div>
<div>key: {{appkey}}</div>
<div>JSON: {{jsonz}}</div>
</div>
Furthermore, here's the controller dedicated to this particular page:
controller('SearchCtrl', ['$scope','$routeParams',function($scope,$routeParams){
$scope.appid = *;
$scope.appkey = *;
if($routeParams.zipcode) {
$scope.zip = $routeParams.zipcode;
$scope.jsonz = $resource('api/:act', {act:'search',appid:$scope.appId,appKey:$scope.appkey,zipCode:$scope.zip}).query();
}
}])
It is assumed that the module has been initialized correctly.
angular.module('myApp.controllers', ['ngResource'])
When the $resource line remains uncommented, the HTML shows up as plain text without any substitution from Angular templates. However, when commented out, zip/id/key are displayed correctly.
I understand that there might be an issue with how I'm implementing the resource functionality, but I'm unsure of the correct approach.
upd: Upon further inspection, it seems like there is an undefined value within angular-resource.js. I plan to investigate this further and possibly re-download AngularJS.
[15:44:57.157] Error: value is undefined
ResourceFactory/extractParams/<@file:///C:/demo/app/lib/angular/angular-resource.js:344
forEach@file:///C:/demo/app/lib/angular/angular.js:137
extractParams@file:///C:/demo/app/lib/angular/angular-resource.js:343
ResourceFactory/</Resource[name]@file:///C:/demo/app/lib/angular/angular-resource.js:398
@file:///C:/demo/app/js/controllers.js:79
invoke@file:///C:/demo/app/lib/angular/angular.js:2902
instantiate@file:///C:/demo/app/lib/angular/angular.js:2914
@file:///C:/demo/app/lib/angular/angular.js:4805
update@file:///C:/demo/app/lib/angular/angular.js:14198
Scope.prototype.$broadcast@file:///C:/demo/app/lib/angular/angular.js:8307
updateRoute/<@file:///C:/demo/app/lib/angular/angular.js:7463
qFactory/defer/deferred.promise.then/wrappedCallback@file:///C:/demo/app/lib/angular/angular.js:6846
qFactory/defer/deferred.promise.then/wrappedCallback@file:///C:/demo/app/lib/angular/angular.js:6846
qFactory/ref/<.then/<@file:///C:/demo/app/lib/angular/angular.js:6883
Scope.prototype.$eval@file:///C:/demo/app/lib/angular/angular.js:8057
Scope.prototype.$digest@file:///C:/demo/app/lib/angular/angular.js:7922
Scope.prototype.$apply@file:///C:/demo/app/lib/angular/angular.js:8143
done@file:///C:/demo/app/lib/angular/angular.js:9170
completeRequest@file:///C:/demo/app/lib/angular/angular.js:9333
createHttpBackend/</xhr.onreadystatechange@file:///C:/demo/app/lib/angular/angular.js:9304