|
@@ -5,12 +5,13 @@
|
|
|
.module('appMessage')
|
|
|
.directive('ngCurrentMsg', CurrentMsg);
|
|
|
|
|
|
- CurrentMsg.inject = ['$location', '$anchorScroll', '$timeout'];
|
|
|
+ CurrentMsg.inject = ['$location', '$anchorScroll', '$compile'];
|
|
|
|
|
|
- function CurrentMsg($location, $anchorScroll, $timeout) {
|
|
|
+ function CurrentMsg($location, $anchorScroll, $compile) {
|
|
|
var directive = {
|
|
|
link: link,
|
|
|
restrict: 'A',
|
|
|
+ controller: ControllerController,
|
|
|
scope: {
|
|
|
msg: '=ngCurrentMsg',
|
|
|
appContent: '=ngAppContent'
|
|
@@ -182,8 +183,8 @@
|
|
|
'<span>大小:' + getFileSize(content) + '</span>' +
|
|
|
'<div class="p-t-sm text-right">' +
|
|
|
'<span id="transinfo"><span style="color:green;" class="glyphicon glyphicon-ok"></span><span>传输完成</span></span>' +
|
|
|
- '<a class="text-primary" role="button"><span ng-click="OpenFile(content)">打开</span></a>  ' +
|
|
|
- '<a class="text-primary" role="button"><span ng-click="OpenDirectory(content)">打开文件夹</span></a>' +
|
|
|
+ '<a class="text-primary" role="button"><span ng-click="OpenFile(msg.content)">打开</span></a>  ' +
|
|
|
+ '<a class="text-primary" role="button"><span ng-click="OpenDirectory(msg.content)">打开文件夹</span></a>' +
|
|
|
'</div>' +
|
|
|
'</div>';
|
|
|
} else if (scope.msg.contentType == 4) {
|
|
@@ -207,9 +208,28 @@
|
|
|
'</div>';
|
|
|
}
|
|
|
console.log(html_g);
|
|
|
- var newElement = angular.element(html_g);
|
|
|
+
|
|
|
+ var compileFn = $compile(html_g);
|
|
|
+ // 传入scope,得到编译好的dom对象(已封装为jqlite对象)
|
|
|
+ // 也可以用$scope.$new()创建继承的作用域
|
|
|
+ var $dom = compileFn(scope);
|
|
|
+ // 添加到文档中
|
|
|
+ var newElement = angular.element($dom);
|
|
|
element.append(newElement);
|
|
|
message.addEventListener('load', gotoBottom());
|
|
|
}
|
|
|
+ };
|
|
|
+ /* @ngInject */
|
|
|
+ function ControllerController($scope) {
|
|
|
+ $scope.OpenFile = function(item) {
|
|
|
+ var file = JSON.parse(item);
|
|
|
+ return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenFile', JSON.stringify(file), $scope);
|
|
|
+ };
|
|
|
+ $scope.OpenDirectory = function(item) {
|
|
|
+ var file = JSON.parse(item);
|
|
|
+ console.log(JSON.stringify(file));
|
|
|
+ return lxtalkClient.Invoke('{15180DEF-D508-45F7-BAEB-6486CD8752C8}', 'OpenDirectory', JSON.stringify(file), $scope);
|
|
|
+
|
|
|
+ };
|
|
|
}
|
|
|
})();
|