This question显示了如何使用Jquery,但我无法在AagularJs中使用它。
我有一个SVG图像,其中包含<path>
个描绘的几个区域,并希望ti检测到哪一个被点击。
路径声明为
<path id="inner" fill="transparent" ng-click='innerRoomClicked'
stroke="black" stroke-width="1"
d="M 132.00,249.00
C 132.00,249.00 132.00,348.00 132.00,348.00
132.00,348.00 180.00,348.00 180.00,348.00
等
和
<path id="A B C"
fill="transparent" ng-click='innerRoomClicked' stroke="black" stroke-width="1"
d="M 171.06,307.00
C 171.06,307.00 167.06,307.00 167.06,307.00
167.06,307.00 169.00,301.94 169.00,301.94
169.00,301.94 171.06,307.00 171.06,307.00 Z
等
,在控制器中,
$scope.outerRoomClicked = function()
{
alert('outerRoomClicked');
}
$scope.innerRoomClicked = function()
{
alert('innerRoomClicked');
}
但是,这两个都没有。我做错了什么?
答案 0 :(得分:1)
更改ng-click =&#39; innerRoomClicked&#39;到ng-click =&#39; innerRoomClicked()&#39;