【发布时间】:2017-06-22 05:51:47
【问题描述】:
他为“svgMap”创建了一个指令
angular.module('SvgMapApp').directive('svgMap', ['$compile', function ($compile) {
return {
restrict: 'A',
templateUrl: 'img/Blank_US_Map.svg',
link: function (scope, element, attrs) {
}
}
}]);
返回一个模板(svg 文件)并使用它,在 index.html 中,他使用了<div svg-map></div>
我对指令的用法有点困惑。为什么“svgMap”会自动链接到“svg-map”?抱歉,我是指令方面的新手。
【问题讨论】:
标签: angularjs svg angularjs-directive