0
我一直在使用這個開源的核心,想添加我自己的功能。如何在服務中創建公共方法
這裏的服務:
"use strict";
define([
'mediastream/webrtc'
], function(WebRTC) {
return function() {
this.testcall = function() {
console.log(1);
}
};
});
這是我如何稱呼它:
"use strict";
define(['underscore', 'text!partials/buddylist.html'], function(_, template) {
// buddyList
return ["buddyList", "api", "webrtc", "contacts", "sourceDistribution", function(buddyList, api, webrtc, contacts, sourceDistribution) {
//console.log("buddyList directive");
var controller = ['$scope', '$element', '$attrs', function($scope, $element, $attrs) {
...
$scope.doViewBroadcast = function(id) {
sourceDistribution.testcall();
};
那麼,如何調用testcall()
功能?
沒有想法? ....... – IvRRimUm