我正在使用jqcloud指令。我遵循了文档中描述的所有步骤。但仍然无法正常工作。
我的代码:
的HTML
<div class="item" href="/clients"></div>
<ion-content ng-controller="clientsController as clients" style="margin-top: 25px">
<div class="demo">
<jqcloud words="clients.words" width="500" height="350" steps="7"></jqcloud>
</div>
JS:
angular.module('starter.clientsController', ['ionic', 'angular-jqcloud'])
.controller('clientsController', function ($scope){
$scope.words = [{text: "Lorem", weight: 13},
{text: "Ipsum", weight: 10.5},
{text: "Dolor", weight: 9.4},
{text: "Sit", weight: 8},
{text: "Amet", weight: 6.2},
{text: "Consectetur", weight: 5},
{text: "Adipiscing", weight: 5},];
});
更新:
问题是我没有添加
jqcloud.js
文件,仅添加了包装器。现在,我没有收到错误,但是我得到了空白页。
最佳答案
您已使用#demo id,但从未在HTML代码中使用过:
请尝试以下操作:
<div class="item" href="/clients"></div>
<ion-content ng-controller="clientsController" style="margin-top: 25px">
<div id='demo' width="500" height="350" steps="7"></div>
</ion-content>
角部分:
angular.module('starter.clientsController', ['ionic', 'angular-jqcloud'])
.controller('clientsController', function ($scope){
$scope.words = [{text: "Lorem", weight: 13},
{text: "Ipsum", weight: 10.5},
{text: "Dolor", weight: 9.4},
{text: "Sit", weight: 8},
{text: "Amet", weight: 6.2},
{text: "Consectetur", weight: 5},
{text: "Adipiscing", weight: 5},];
$('#demo').jQCloud($scope.words);
});