<div ng-init="offers = [
{state:'Zabiorę', from:'Warszawa', to:'Wrocław', date:'30/04/16', size:'S:8 M:4 L:2 XL:0'},
{state:'Wyśle', from:'Wrocław', to:'Warszawa', date:'31/04/16', size:'S:0 M:1 L:0 XL:0'}]">
<div ng-repeat="offer in offers">
<hr class="featurette-divider">
<div class="announcement row">
<div class="col-md-1"><strong>{{offer.state}}</strong></div>
<div class="col-md-2">
<img class="img-circle"
src="data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw=="
alt="Generic placeholder image" width="70" height="70">
</div>
<div class="col-md-1">{{offer.from}}</div>
<div class="col-md-1"><span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></div>
<div class="col-md-1">{{offer.to}}</div>
<div class="col-md-2">{{offer.date}}</div>
<div class="col-md-2">{{offer.size}}</div>
<div class="col-md-2">
<button type="button" class="btn btn-primary">Szczegóły</button>
</div>
</div>
</div>
</div> // </div ng-cloak>
您好,我刚刚在我的jhipster项目中编写了一些代码,我在我的一个项目模板中写道,它只是不起作用,它什么都没有显示。在jsfiddle.net上它可以工作。
@edit
整个代码,控制器和状态:
- http://pastebin.com/2tkvbiwG - template.html
- http://pastebin.com/kV4E7x0G - state.js
- http://pastebin.com/XF5rBmK7 - controller.js
答案 0 :(得分:2)
您的代码应该可以正常工作。请检查您是否包含angular.js,并确定已定义ng-app
和ng-controller
这是一个吸虫: https://plnkr.co/edit/JLIQJQoEM9q4iAztY7KQ?p=preview
在controller.js中你需要像这样定义ui-router。
angular
.module('deliveritApp', ['ui.router'])
.controller('SearchOfferController', SearchOfferController);
同时将您的function SearchController
命名为function SearchOfferController
。
在state.js中,您需要在配置中添加$stateProvider
,如下所示:
angular
.module('deliveritApp')
.config(['$stateProvider', stateConfig])