角度1.4.7 ng重复

时间:2016-03-13 16:35:11

标签: angularjs

我遇到问题ng-repeat投掷注入错误。我不是一个先进的角度开发者,也许是新手。但我知道这是在某一点工作然后噗。不见了!

我做了哪些不同的事情?我将localhost路径更改为角度到CDN。我在模板中测试了它,我从最初复制了这个工作,它在那里工作。但不是在我的网站上。

我的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>

我的控制器:

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/'
      }];
 });

这是错误:

  

错误:[$ injector:unpr] http://errors.angularjs.org/1.4.7/ $ injector / unpr?p0 = nProvider%20%3C-%20n%20%3C-NaNataImagesWork
出现错误(本机)
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:40:409处在Object.d [as get](https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:38:394
https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:40:483 d(https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:38:394
在Object.e [作为调用](https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:39:161
在P.instance(https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:80:207
在K({ {3}})
在g(https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:61:190

任何帮助将不胜感激

如果有帮助,这是https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.7/angular.min.js:54:410

2 个答案:

答案 0 :(得分:1)

您没有加载uiGmapgoogle-maps模块文件,
从角度模块依赖项中删除uiGmapgoogle映射将解决此问题。

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

此外,您没有附加过滤器文件,因此您需要从ngRepeat中删除过滤器。

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

请参阅以下工作样本:http://codepen.io/anon/pen/BKLdyP?editors=1011

答案 1 :(得分:1)

  1. 删除&#39; uiGmapgoogle-maps&#39;模块dependecies

  2. 与数据绑定的链接,您必须使用ng-href,替换href

  3. 我建议按照角度2的preparation guide和Jhon Papa的角度风格指南编写角度应用