简体   繁体   中英

Angular 1.4.7 ng-repeat

I'm having an issue with ng-repeat where is throwing an injection error. I'm not an advance angular developer, a novice maybe. But I know this was working at one point and then poof. Gone!

What did I do different? I changed my localhost path to angular to a CDN instead. I tested it in the template I copied this work from originally and it works there. But not in my site.

My HTML:

<div id="cbp-vm" class="activegrid">
      <ul id="product" class="nav-pills nav-stacked rectangle-list" ng-controller="dataImagesWork">
          <li class="col-md-4 my-gallery-animation-home3" ng-repeat="product in images_work | filter:myFilter">
              <img ng-src="../img/projects/{{product.src}}" alt="{{product.name}}" /><br />
              <label class="title" href=""> {{product.name}} </label>
              <a class="btn btn-lg btn-primary pull-right" href="{{product.link}}" target="_blank" rel="nofollow">View</a>
          </li>
      </ul>
</div>

My Controller:

app.controller("dataImagesWork", function ($scope) {
$scope.images_work = [
      {
          "name": 'PA Liquor Control Board',
          "src": "Liquor-Control-Board340.png",
          "link": "http://www.finewineandgoodspirits.com/webapp/wcs/stores/servlet/StoreCatalogDisplay?storeId=10051&catalogId=10051&langId=-1"
      },
      {
          "name": 'PA Provider Self Service',
          "src": "Provider-Services-of-PA340.png",
          "link": 'https://www.pelican.state.pa.us/provider/default.aspx?TYPE=33554433&REALMOID=06-ccc2a1cb-0683-440f-bfa6-cad042af12ba&GUID=&SMAUTHREASON=0&METHOD=GET&SMAGENTNAME=-SM-ZW9pIAMntaN%2bR%2fAG5q4UUzXVDz%2bKoMG2pXXJCs1re8tkRKCZKtgqJypoW9Af5ilo&TARGET=-SM-https%3a%2f%2fwww%2epelican%2estate%2epa%2eus%2fprovider%2fui%2fhome%2easpx#'
      },
      {
          "name": 'Job Gateway',
          "src": "JobGateway340.png",
          "link": 'https://www.jobgateway.pa.gov/jponline/Admin/Common/Portal.aspx?w@cIRFbHc_kyIfEUDPqYpUspb3u_@dnsvVOXen8isTEcdYg4grazpGUr2rtw4QN@odjSSGi8RwBm4_nraX__ITaRZJT8HYWbn3TgGPFcA0A-6xUQEkG_y@pHEMFmjDEEwSppJHEDfIGrVG6yQ4mCf4aazFA4QpEE'
      },
      {
          "name": 'Keystone Canine Rescue',
          "src": "KeystoneCanineRescue340.png",
          "link": 'http://www.keystonecaninerescue.org/'
      }];
 });

Here is the error:

Error: [$injector:unpr] http://errors.angularjs.org/1.4.7/ $injector/unpr?p0=nProvider%20%3C-%20n%20%3C-NaNataImagesWork
at Error (native)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:6:416
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:40:409
at Object.d [as get] ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:38:394 )
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:40:483
at d ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:38:394 )
at Object.e [as invoke] ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:39:161 )
at P.instance ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:80:207 )
at K ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:61:190 )
at g ( https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:54:410 )

Any help would be appreciated

Here is a CODEPEN if it helps

You are not loading uiGmapgoogle-maps module files,
Removing uiGmapgoogle-maps from your angular module dependencies will solve this issue.

var app = angular.module('angula', ['ngRoute', 'ui.bootstrap', 'ngAnimate', 'ngMaterial']);

In addition, you didn't attach the filter file so you will need to remove the filter from your ngRepeat.

<li class="col-md-4 my-gallery-animation-home3" ng-repeat="product in images_work">

See working sample at: http://codepen.io/anon/pen/BKLdyP?editors=1011

  1. Remove 'uiGmapgoogle-maps' of the module dependecies

  2. Links with data-binding, you must use use ng-href , replacing href

  3. I recommend write your angular app following the preparation guide for angular 2. and Jhon Papa's angular style guide

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM