Error: settings.$scope.$emit is not a function
See original GitHub issueHey there, just wanted to start off by saying how much I appreciate the project and the work that’s been going into it.
Anyways, I seem to be having a really weird error. Basically, I can run $scope.tableParams.reload()
twice with no problem, but on the third execution, and every following one, I get the following error:
TypeError: Cannot set property '$data' of null at [removed]/ng-table.js:411:55
I believe this is all the relevant code, but if anything is missing let me know:
$scope.lookupAddress = function(address){
var url = 'https://blockchain.info/multiaddr?cors=true&active='+address;
$scope.loading = true;
$scope.clearTableData();
$http.get(url).success(function(data){
$scope.loading = false;
$scope.loaded = true;
$scope.loadError = false;
glob = data;
//Removed code that processes the response.
};
//Enables new data to be loaded, e.g. on a new address.
//Pretty sure it's not working right now.
if ($scope.tableParams){
$scope.tableParams.reload();
}
data = transactions; //this data var is what is called by the tables. Unsure if can remove.
$scope.tableParams = new ngTableParams({
page: 1,
count: 5, // items per page
sorting: {
Date: 'desc'
}
}, {
total: transactions.length,
getData: function($defer, params) {
data = transactions;
var orderedData = params.sorting() ? $filter('orderBy')(data, params.orderBy()) : data;
$defer.resolve(orderedData.slice((params.page() - 1) * params.count(), params.page() * params.count()));
}
});
}).
error(function(data){
$scope.loadError = true;
});
}
$scope.clearTableData = function(){
transactions = [];
$scope.output = {}
if ($scope.tableParams){
$scope.tableParams.reload();
}
}
Issue Analytics
- State:
- Created 9 years ago
- Comments:50 (3 by maintainers)
Top Results From Across the Web
Angularjs: $scope.emit is not working - Stack Overflow
The problem i have is that $scope.$emit does not seem to be working, i am looking for ways to contact functions between controllers...
Read more >$rootScope.Scope - AngularJS: API
Overview. A root scope can be retrieved using the $rootScope key from the $injector. Child scopes are created using the $new() method.
Read more >$scope.$on function is not running - Google Groups
Hi everybody, I'm trying to use $scope.$on and $rootScope.$broadcast in order to use a variable of a controller function in another controller function....
Read more >Working with $scope.$emit and $scope.$on - javascript tutorial
emit . If scope of firstCtrl is parent of the secondCtrl scope: function firstCtrl($scope) { $scope ... $rootScope listener are not destroyed automatically....
Read more >EventEmitter - Angular
Parameters. value, T. The value to emit. Optional. Default is undefined .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Had the same problem. Hasi’s solution fixed it pretty easily. Thanks!
I also had the same issue and after 2 days of a struggle managed to fix it using folliwing code line just after the
For more info please refer https://github.com/esvit/ng-table/blob/master/src/scripts/04-controller.js#L33