简体   繁体   English

角度1.4.7 ng-重复

[英]Angular 1.4.7 ng-repeat

I'm having an issue with ng-repeat where is throwing an injection error. 我在ng-repeat发生问题,这会导致注入错误。 I'm not an advance angular developer, a novice maybe. 我不是高级开发人员,也许是新手。 But I know this was working at one point and then poof. 但是我知道这在某个时候奏效,然后又of。 Gone! 走了!

What did I do different? 我有什么不同? I changed my localhost path to angular to a CDN instead. 我将本地主机路径改为了CDN。 I tested it in the template I copied this work from originally and it works there. 我在模板中对其进行了测试,该模板最初是从此复制而来的,并且在那里可以正常工作。 But not in my site. 但是不在我的网站上。

My HTML: 我的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 错误:[$ 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 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 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 ) 在Object.d [获取]( 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 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 ) 在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 ) 在Object.e [作为调用]( 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 ) 在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 ) 在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 ) 在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 这是一个CODEPEN,如果有帮助

You are not loading uiGmapgoogle-maps module files, 您没有加载uiGmapgoogle-maps模块文件,
Removing uiGmapgoogle-maps from your angular module dependencies will solve this issue. 从您的angular模块依赖项中删除uiGmapgoogle-maps将解决此问题。

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. 此外,您没有附加过滤器文件,因此需要从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 请参阅以下工作示例: http : //codepen.io/anon/pen/BKLdyP?editors=1011

  1. Remove 'uiGmapgoogle-maps' of the module dependecies 删除模块依赖项的“ uiGmapgoogle-maps”

  2. Links with data-binding, you must use use ng-href , replacing href 具有数据绑定的链接,必须使用ng-href代替href

  3. I recommend write your angular app following the preparation guide for angular 2. and Jhon Papa's angular style guide 我建议您按照角度2的准备指南和Jhon Papa的角度样式指南编写您的角度应用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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