我的主页上有以下代码:



<body>
    <div id="leftMenu" ng-app=SearchApp>
    	<div id="searchFoldersList"><span class="icon-search search"></span><input ng-model="searchFolder" type="text" placeholder="Search..." /></div>
    	<div id="foldersList" ng-controller="empCtrl">
        	<ul>
                <li ng-repeat="fold in folder | filter: searchFolder">{{fold.Folder}} <div id="editFolder_menu"><span class="icon-edit"></span></div></li>
                <li ng-show="showInputBox = !showInputBox" id="addFolderInputBox"><input ng-model="fname" name="fname" class="changeNameFolder" placeholder="New folders name..." type="text" /></li>
            </ul>
        </div>
    	<div id="addFolderBox" ng-click="showInputBox"><span class="icon-add plus"></span> ADD NEW FOLDER</div>
    </div>
    <div id="rightContent">
        <div id="menuContent">
        	<ul>
            	<li><span class="icon-list"></span></li>
                <li><span class="icon-settings"></span></li>
                <li><span class="icon-account-circle"></span></li>
            </ul>
        </div>
    </div>
</body>





而在scripts.js上:



$(document).ready(function() {
	$("#foldersList ul li").click(function(){
	alert("HELLO");
		});
});





知道为什么这行不通吗?

我认为是因为某些因素干扰了angularJS。

谢谢!

最佳答案

代替这样做,将ng-click =“ someFunc()”添加到您的li元素中,并将someFunc定义为empCtrl范围的属性

09-26 10:28