试图使用角度记录仪,找不到控制器

时间:2015-10-29 09:17:26

标签: angularjs

我正在尝试使用https://github.com/logbon72/angular-recorder

中的角度记录器
  Controller 'ngAudioRecorder', 
required by directive 'ngAudioRecorderAnalyzer', can't be found!

我已完成bower-install并将文件添加到依赖项中。 我尝试使用<ng-audio-recorder-analyzer></ng-audio-recorder-analyzer>

时收到上述错误

更新

正如Y.Puzyrenko所述,需要在<ng-audio-recorder-analyzer>内附加一个<ng-audio-recorder> recorder controller对象。

有效的代码:

<ng-audio-recorder id='audioInput' audio-model="recorder.audioModel">
    <!-- Start controls, exposed via recorder-->
        Current microphone input:
        <ng-audio-recorder-analyzer  ng-model="a.audioModel"></ng-audio-recorder-analyzer>
        <button ng-click="recorder.startRecord()" type="button" ng-disabled="recorder.status.isRecording" class="btn btn-default">
            Start Record
        </button>
        <button ng-click="recorder.stopRecord()" type="button" ng-disabled="recorder.status.isRecording === false" class="btn btn-default">
            Stop Record
        </button>
        <button ng-click="recorder.playbackRecording()" type="button"
         ng-disabled="recorder.status.isRecording || !recorder.audioModel" class="btn btn-default"> Playback
        </button>
    <!-- End controls-->
</ng-audio-recorder>

1 个答案:

答案 0 :(得分:1)

发生此问题是因为您没有在元素上指定ng-audio-recorder指令,或者它是父元素。 例如。 <ng-audio-recorder><ng-audio-recorder-analyzer></ng-audio-recorder-analyzer></ng-audio-recorder>

Docs