Hi, I’ve a SideMenu with a ng-repeat populated by $http. So when I click on item , I call a view and controller, but not display the view in sidemenu because I’ve always “TypeError: Cannot call method ‘insertBefore’ of null”
Code:
Index Menu:
Child View ( into html external file )
<ion-item ng-repeat="item in itemList" type="item-text-wrap" href="">
</ion-item>
Controller:
.controller(‘PfItemsCtrl’, function($scope, $stateParams, $http, exchAPIservice) {
// “Pets” is a service returning mock data (services.js)
$scope.headerTitle = “Elenco PF 2”;
$scope.itemList = [];
Error: Failed to execute 'replaceChild' on 'Node': The node to be replaced is not a child of this node.
at Error (native)
at http://app.godisco/src/vendor/angular/angular.js:2937:16
at forEach (http://app.godisco/src/vendor/angular/angular.js:328:18)
at forEach.replaceWith (http://app.godisco/src/vendor/angular/angular.js:2933:5)
at Object.JQLite.(anonymous function) [as replaceWith] (http://app.godisco/src/vendor/angular/angular.js:3061:17)
at IonicModule.controller._animateTitles (http://app.godisco/src/vendor/ionic/release/js/ionic-angular.js:3836:32)
at IonicModule.controller.changeTitle (http://app.godisco/src/vendor/ionic/release/js/ionic-angular.js:3811:12)
at link (http://app.godisco/src/vendor/ionic/release/js/ionic-angular.js:7751:22)
at nodeLinkFn (http://app.godisco/src/vendor/angular/angular.js:6648:13)
at compositeLinkFn (http://app.godisco/src/vendor/angular/angular.js:6039:13) <ion-view class="ng-enter pane">
I also tried to replace the sref with function in the controller which do $state.go()…
this is really odd… sometime it just work randomly.
Edit:
I doesn’t realize it yet… but I think after a few times it does work. maybe after the ajax on the “new” page is loaded… it seams like it related to the title. I tried to add temporary title until the ajax is loaded but it didn’t helped.
Edit:
I have a guess that this issue is happening after “too fast” clicking on the element after it load. if I wait a second or two after the element is load then clicked it work. weirddd…