我想要做的是點擊一個按鈕,我試圖讓用戶選擇顯示的2個圖像中的一個,並使所選圖像可拖動。 我的代碼顯示2個圖像,1個可拖動。我無法弄清楚如何添加功能,讓用戶選擇2個圖像之一和書房作出這樣的選擇的圖像拖動無法弄清楚如何修改角度指令
這裏是我的html代碼
<div ng-app="test">
<button name="Add" type="buton" ng-click="showMarker = true">Show List</button>
<hello>
</hello>
</div>
下面是javascript代碼
angular.module('test', []).directive('hello', function() {
return {
restrict : 'E',
template : '<div style="position: relative" ng-show="showMarker"><img id="mr" src="http://www.mbs.edu/i/gmap_marker_default.gif" /><img src="http://www.hypercosm.com/images/icons/add_marker_icon2.gif" /></div>',
replace: true,
link : function(scope, element, attrs) {
$("#mr").draggable();
}
};
})
這裏是jsfiddle
實際上不是我想要的,但它仍然很好,讓我開始..thnks :) – iJade 2013-03-06 08:43:02
@iBlue你想要什麼? – ganaraj 2013-03-06 12:01:38
我想要的是一個彈出式窗口,其中將顯示2個標記,並且我選擇的標記將在屏幕上使用 – iJade 2013-03-06 12:27:29