0
我試圖寫一個指令限制C
在TypeScript但鏈接沒有被調用。我錯過了什麼?角度指令限制「C」不能正常工作
/// <reference path="../../../typings/jquery.tooltipster/jquery.tooltipster.d.ts" />
/// <reference path="../../../typings/angularjs/angular.d.ts" />
/// <reference path="../stationstaff.ts" />
module App.StationStaff {
class BedDetailDirective implements ng.IDirective {
public static factory() {
var directive =() => new BedDetailDirective();
directive.$inject = [];
return directive;
}
public restrict = "C";
public link($scope: ng.IScope, element: JQuery, attributes: ng.IAttributes) {
var $element = $(element);
var content = "<div class='tooltipster-header'><span>Art: Elektrisch</span></div><div class='tooltipster-body'><span>ID: BSHR1114</span><span>Ort: Station SR.1 - Raum: 10</span><span>Hersteller: Hill-Rom</span><span>Nächster Service: 31.05.2015</span></div>";
$element.tooltipster({
content: content,
contentAsHTML: true,
animation: "fade",
theme: "hpm-tooltipster",
position: "right",
trigger: "click",
functionReady(e) {
e.addClass("hpm-item-active");
},
functionAfter(e) {
e.removeClass("hpm-item-active");
}
});
}
}
angular.module("appStationStaff", [])
.directive("tooltip", BedDetailDirective.factory());
}
<ion-view ng-controller="bedFinderResultController as vm">
<ion-content>
<div class="list">
<div class="item item-balanced item-icon-right item-royal hpm-item-medium" ng-repeat="bed in vm.beds">
<div class="hpm-item-icon text-center ion-ios-information-outline tooltip">
</div>
<div class="hpm-bed-availability-red"></div> <!-- TODO: Color should come from controller -->
<div class="row">
<div class="col">
<div class="row">
<div class="hpm-item-title">
<span>Type: {{bed.type}}</span>
</div>
</div>
<div class="row">
<div class="hpm-item-subtitle">
<span>{{bed.location}} - Room: {{bed.room}}</span>
</div>
</div>
</div>
<div class="col">
<div class="row">
<i class="icon ion-ios-arrow-right"></i>
</div>
</div>
</div>
</div>
</div>
</ion-content>
</ion-view>