我正在构建一个离子应用程序,在我的模板上我有一个列表,我希望在我的控制器中定义的离子的列表中以特定间隔(比如每2秒)一次填充单个离子
我的控制器:
.controller('DashCtrl', function($scope, $timeout) {
$scope.ionicon_class_list1=['ion-xbox','ion-ribbon-a', 'ion-trophy', 'ion-ios-football','ion-android-bicycle'];
$scope.ionicon_class_list2=['ion-wrench','ion-scissors', 'ion-gear-b', 'ion-ios-alarm-outline','ion-ios-flask'];
$scope.ionicon_class_list3=['ion-edit','ion-clipboard', 'ion-calculator', 'ion-printer','ion-android-calendar'];
$scope.current_symbol_for_list1 = '';
for(symbol in $scope.ionicon_class_list1){
/* logic to select symbol at a specific time interval */
}
$scope.setSymbol = function(symbol){
$scope.current_symbol_for_list1=symbol
}
})
我的HTML:
<ion-view view-title="Dashboard">
<ion-content class="padding">
<div class="row">
<div class="col col1" align="center">
<i class="icon {{current_symbol_for_list1}}"></i>
</div>
<div class="col col2" align="center">
<ion-list>
<ion-item ng-repeat="symbol in ionicon_class_list2">
<i class="icon {{symbol}}"></i>
</ion-item>
</ion-list>
</div>
<div class="col col3" align="center">
<ion-list>
<ion-item ng-repeat="symbol in ionicon_class_list3">
<i class="icon {{symbol}}"></i>
</ion-item>
</ion-list>
</div>
</div>
<div align="center">
<button class="button button-dark">Start</button>
</div>
</ion-content>
</ion-view>
我该怎么办?普兰克:http://plnkr.co/edit/eYKQPM?p=preview
注意:当我点击“开始”按钮时单个Ionicon将出现在三列中的每一列中(最初列为空),持续2秒,然后它将发生变化。
答案 0 :(得分:0)
在控制器中我添加了:
ng-click="iterator()"
在HTML中 在开始按钮
function jqueryPlugin (selector, properties) {
this.properties = {
foo: properties.foo || 'foo',
bar: properties.bar || 'bar'
};
// this.element = $(selector);
// ...
console.log('element loaded... plugin start working...')
// ...
this.reload = function (properties) {
// ...
this(selector, properties); // ??
};
};
var instance = new jqueryPlugin('.foobar', {foo:'foooo'});
// ...
instance.reload({foo:'foobar'});