Javascript 如何调试未被调用的AngularJS函数?

Javascript 如何调试未被调用的AngularJS函数?,javascript,html,jquery,angularjs,ajax,Javascript,Html,Jquery,Angularjs,Ajax,我有一张桌子 我已经构建了这些行和行动按钮动态一旦用户点击设备手风琴 当用户单击(I)时 从来没有 这是我的全部代码 $('#wifi-devices-nav').click( function() { if($('#wifi-devices-nav').hasClass('callout-expanded')) { $.ajax({ method: 'GET', url: '/api/telenet/' + '{{ $

我有一张桌子

我已经构建了这些行和行动按钮动态一旦用户点击设备手风琴

当用户单击(I)时

从来没有


这是我的全部代码

$('#wifi-devices-nav').click( function() {
    if($('#wifi-devices-nav').hasClass('callout-expanded')) {

        $.ajax({
            method: 'GET',
            url: '/api/telenet/' + '{{ $cpe_mac }}' + '/privateDevices',
            crossDomain: true,
            contentType: false,
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
                "Accept": "application/json",
                "Content-Type": "application/x-www-form-urlencoded",
                "Cache-Control": "no-cache"
            },
            success: function(response){


                $('.lds-ripple').fadeOut();


                console.log(response.length);


                for (i = 0; i < response.length; i++) {


                    var device = response[i];


                    if(device.up) {
                        console.log(device);
                    }


                    if(device.device_activity != "OFFLINE" && device.device_activity_v6 != "OFFLINE" ) {


                        console.log(response[i]);

                        if(device.up) {
                            var uplink = device.up.value + ' ' + device.up.suffix;
                        }


                        if(device.down) {
                            var downlink = device.down.value + ' ' + device.up.suffix;
                        }


                        if(device.device_activity == 'ACTIVE') {
                            var deviceStatus = 'green';
                        }else {
                            var deviceStatus = 'orange';
                        }


                        let row = `
                        <tr id="tr-${device.device_mac}">
                        <td>

                        {{-- Status --}}
                        <i class="device-status-circle fa fa-circle ${deviceStatus}" style="margin-left:7px; ">
                        </i>


                        ${device.device_mac}
                        </td>
                        <td class="text-center">${device.ip_address_v6}</td>
                        <td class="text-center">${device.last_active} </td>
                        <td class="text-center">

                        <!-- View -->
                        <a href="" class="stats-modify-btn" title="Device Info" ng-hide="editDevice.num == $index" ng-click="device.viewEnabled = !device.viewEnabled; device.settingsEnabled = null; expandCollapseCurrent(device);"> <i class="fa fa-info ml15"></i> </a>

                        <!-- Edit -->
                        <a href="" class="stats-modify-btn" title="Edit" ng-hide="editDevice.num == $index" ng-click="editDevice.num = $index; hideAllBoxes()"> <i class="fa fa-pencil ml15"></i> </a>

                        <!-- Settings -->
                        <a href="" class="stats-modify-btn" title="Settings" ng-hide="editDevice.num == $index" ng-click="device.settingsEnabled = !device.settingsEnabled; device.viewEnabled = null; expandCollapseCurrent(device);"> <i class="fa fa-cog ml15"></i> </a>
                        </td>
                        </tr>

                        `;


                        $('#tablePrivateDevices').prepend(row).fadeIn('slow');
                    }

                }

            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log(JSON.stringify(jqXHR));
                console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
            }
        });
    }

});
$('wifi设备导航')。单击(函数(){
if($(“#wifi设备导航”).hasClass('callout-expanded')){
$.ajax({
方法:“GET”,
网址:'/api/telenet/'+'{{$cpe_mac}}'+'/privateDevices',
跨域:是的,
contentType:false,
标题:{
'X-CSRF-TOKEN':$('meta[name=“CSRF-TOKEN”]”)。attr('value'),
“接受”:“应用程序/json”,
“内容类型”:“应用程序/x-www-form-urlencoded”,
“缓存控制”:“无缓存”
},
成功:功能(响应){
$('.lds ripple').fadeOut();
console.log(响应.长度);
对于(i=0;i

最新观察结果 我单击的3个按钮中的任何一个都将刷新页面

我不知道为什么会这样



任何提示/建议对我来说都很重要。

你不能像
那样添加html,你不能像
那样添加html。单击
不接受使用分号的表达式。它应该是“一行”表达式。您应该调用一个函数来执行这三条语句。@eventHandler不是true,它可以处理它@eventHandler我同意Charly的观点,我以前用链子锁住过它们,而且它过去是有效的。@charly1212的答案不正是我已经做过的吗?我不确定我在这里错过了什么;
a
标签中的
device
代表什么?应用程序是否在没有任何警告的情况下正确呈现?I gess
ng click
不接受使用分号的表达式。它应该是“一行”表达式。您应该调用一个函数来执行这三条语句。@eventHandler不是true,它可以处理它@eventHandler我同意Charly的观点,我以前用链子锁住过它们,而且它过去是有效的。@charly1212的答案不正是我已经做过的吗?我不确定我在这里错过了什么;
a
标签中的
device
代表什么?应用程序是否在没有任何警告的情况下正确渲染?
$scope.expandCollapseCurrent = function(currentDevice) {
    console.log('%c currentDevice = ' + currentDevice, "color: green;");
    angular.forEach($scope.private_devices, function(device) {
        if(device.name != currentDevice.name) {
            device.settingsEnabled = false;
            device.viewEnabled = false;
        }

        $scope.buttonShow.bandwidth = false;
        $scope.buttonShow.acl = false;
    });
}
$('#wifi-devices-nav').click( function() {
    if($('#wifi-devices-nav').hasClass('callout-expanded')) {

        $.ajax({
            method: 'GET',
            url: '/api/telenet/' + '{{ $cpe_mac }}' + '/privateDevices',
            crossDomain: true,
            contentType: false,
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('value'),
                "Accept": "application/json",
                "Content-Type": "application/x-www-form-urlencoded",
                "Cache-Control": "no-cache"
            },
            success: function(response){


                $('.lds-ripple').fadeOut();


                console.log(response.length);


                for (i = 0; i < response.length; i++) {


                    var device = response[i];


                    if(device.up) {
                        console.log(device);
                    }


                    if(device.device_activity != "OFFLINE" && device.device_activity_v6 != "OFFLINE" ) {


                        console.log(response[i]);

                        if(device.up) {
                            var uplink = device.up.value + ' ' + device.up.suffix;
                        }


                        if(device.down) {
                            var downlink = device.down.value + ' ' + device.up.suffix;
                        }


                        if(device.device_activity == 'ACTIVE') {
                            var deviceStatus = 'green';
                        }else {
                            var deviceStatus = 'orange';
                        }


                        let row = `
                        <tr id="tr-${device.device_mac}">
                        <td>

                        {{-- Status --}}
                        <i class="device-status-circle fa fa-circle ${deviceStatus}" style="margin-left:7px; ">
                        </i>


                        ${device.device_mac}
                        </td>
                        <td class="text-center">${device.ip_address_v6}</td>
                        <td class="text-center">${device.last_active} </td>
                        <td class="text-center">

                        <!-- View -->
                        <a href="" class="stats-modify-btn" title="Device Info" ng-hide="editDevice.num == $index" ng-click="device.viewEnabled = !device.viewEnabled; device.settingsEnabled = null; expandCollapseCurrent(device);"> <i class="fa fa-info ml15"></i> </a>

                        <!-- Edit -->
                        <a href="" class="stats-modify-btn" title="Edit" ng-hide="editDevice.num == $index" ng-click="editDevice.num = $index; hideAllBoxes()"> <i class="fa fa-pencil ml15"></i> </a>

                        <!-- Settings -->
                        <a href="" class="stats-modify-btn" title="Settings" ng-hide="editDevice.num == $index" ng-click="device.settingsEnabled = !device.settingsEnabled; device.viewEnabled = null; expandCollapseCurrent(device);"> <i class="fa fa-cog ml15"></i> </a>
                        </td>
                        </tr>

                        `;


                        $('#tablePrivateDevices').prepend(row).fadeIn('slow');
                    }

                }

            },
            error: function(jqXHR, textStatus, errorThrown) {
                console.log(JSON.stringify(jqXHR));
                console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
            }
        });
    }

});