Я установил через "npm install angular -d3-word-cloud" angular -de-word-cloud, но в веб-консоли появляется сообщение:
Error: Template parse errors:
'word-cloud' is not a known element:
1. If 'word-cloud' is an Angular component, then verify that it is part of this module.
2. If 'word-cloud' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
<div id="wordsCloud">
[ERROR ->]<word-cloud words="appCtrl.words" width="appCtrl.width" height="appCtrl.height" padding="5" rotate="a"): ng:///Wordcloud...
the html страница
<div id="wordsCloud">
<word-cloud words="appCtrl.words" width="appCtrl.width" height="appCtrl.height" padding="5" rotate="appCtrl.rotate" random="appCtrl.random" use-transition="appCtrl.useTransition" on-click="appCtrl.wordClicked">
</word-cloud>
</div>
и компонент
import * as angular from "angular";
(function(){
angular.module('app',['angular-d3-word-cloud'])
.controller('appController',['$window','$element',appController])
function appController($window,$element){
var self = this;
self.height = $window.innerHeight * 0.5;
self.width = $element.find('#wordsCloud')[0].offsetWidth;
self.wordClicked = wordClicked;
self.rotate = rotate;
self.useTooltip = true;
self.useTransition = false;
self.words = [
{text: 'Angular',size: 25, color: '#6d989e', tooltipText: 'Angular Tooltip'},
{text: 'Angular2',size: 35, color: '#473fa3', tooltipText: 'Angular2 Tooltip'}
]
self.random = random;
function random() {
return 0.4; // a constant value here will ensure the word position is fixed upon each page refresh.
}
function rotate() {
return ~~(Math.random() * 2) * 90;
}
function wordClicked(word){
alert('text: ' + word.text + ',size: ' + word.size);
}
}
})()
Есть идеи, как решить проблему? Буду очень признателен!