23 lines
610 B
JavaScript
23 lines
610 B
JavaScript
|
'use strict';
|
||
|
|
||
|
angular
|
||
|
.module('sloDialectsApp')
|
||
|
|
||
|
.directive('ngWavesurfer', function () {
|
||
|
return {
|
||
|
restrict: 'E',
|
||
|
|
||
|
link: function ($scope, $element, $attrs) {
|
||
|
$element.css('display', 'block');
|
||
|
|
||
|
var options = angular.extend({ container: $element[0] }, $attrs);
|
||
|
var wavesurfer = WaveSurfer.create(options);
|
||
|
|
||
|
if ($attrs.url) {
|
||
|
wavesurfer.load($attrs.url, $attrs.data || null);
|
||
|
}
|
||
|
|
||
|
$scope.$emit('wavesurferInit', wavesurfer);
|
||
|
}
|
||
|
};
|
||
|
});
|