Answer the question
In order to leave comments, you need to log in
Angularjs: [object Error]undefined IE8???
I have already tried everything, tell me where the error can be? ..
main page:
<html xmlns:ng="http://angularjs.org" class="ng-app:work" id="work" ng-app="work"> <head> <!--[if lte IE 8]> <script> document.createElement('ng-view'); </script> <![endif]--> ...... <body> .......... <divng-view></div> .....
var work = angular.module('work', []). config(function($routeProvider){ $routeProvider. when('/', {controller:workCtrl, templateUrl:'/ang/work/list.html'}). when('/log/:memberId', {controller:logCtrl, templateUrl:'/ang/work/log.html'}). when('/edit/:itemId', {controller: itemEditCtrl, templateUrl:'/ang/work/edit.html'}). when('/add/', {controller:workNewCtrl, templateUrl:'/ang/work/add.html'}). when('/add-log/:memberId', {controller:logNewCtrl, templateUrl:'/ang/work/add-log.html'}). otherwise({redirectTo:'/'}); }); //controller function workCtrl($scope, $http, $location){ $http({ method: 'POST', headers: 'application/x-www-form-urlencoded', url: "/ang/work/ajax.php", data: {'action':"list" } }).success(function (data, code) { $scope.list = data.list; $scope.status = ""; }); // show status while loading member $scope.status = "loading works direct"; // return member count $scope.list_count = function(){ if ($scope.list){ return $scope.list.length; } else { return 0; } } // del $scope.del_item = function(id){ $http({ method: 'POST', headers: 'application/x-www-form-urlencoded', url: "/ang/work/ajax.php", data: {'action':"del", "id":id } }).success(function (data, code) { $scope.status = "deleted"; var old_list = $scope.list; $scope.list = []; if (data.data == 'ok'){ angular.forEach(old_list, function(item){ if (item.id != id) $scope.list.push(item); }); } }); }//*/ }
Answer the question
In order to leave comments, you need to log in
Changed to this, everything works:
<!DOCTYPE html>
<html xmlns:ng="http://angularjs.org">
...........
<body>
.......
<div ng-view class="ng-app:work" id="ng-app" ng-app="work"></div>
.......
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question