Open kslo88 opened 8 years ago
The value has to be a variable and not just a value like so callback="callbackvariable" and not callback="callbackfunction()"
The callback would be a variable in the scope assigned to a function
function callback function(){
//do stuff here
}
$scope.callbackvariable = callbackfuntion;
Apologies, this doesn't work, it doesn't resolve scope changes
Hello, I'm facing the same issue with integration of this component , I'm running the code from the example in main.js file in this repo. The error occurs when I import a file within my node app code, the scope is loaded with results correctly, but the console logs the TypeError: scope.callback is not a function at angular-csv-import: 68 I'm wondering whats wrong with my integration, because I can't fix the entire code of the module.
+1
Running angular.js 1.5.8 and getting TypeError: scope.callback is not a function
+1 Running angular.js 1.5.8 and getting TypeError : scope.callback is not a function
can anybody resolve this error
Same error here with Angular 1.4.0
To Fix, this issue finds the instructions below.
in your HTML
<ng-csv-import class="import" content="csv.content" header="csv.header" header-visible="csv.headerVisible" separator="csv.separator" separator-visible="csv.separatorVisible" result="csv.result" encoding="csv.encoding" encoding-visible="csv.encodingVisible" callback="csvCallback">
In Controller
$scope.csvCallback = function (result) { // alert("define anything") }
not working
In the definition of the directive the callback attribute is using = for bidirectional binding; It should probably use & to bind to an expression. This would allow the use of the callback similar to ngChange or ngClick.
add this into ur controller.
$scope.csv = { content: null, header: true, headerVisible: true, separator: ',', separatorVisible: true, result: null, encoding: 'ISO-8859-1', encodingVisible: true, accept: true, callback: 'csvCallback' };
$scope.csvCallback = function (result) {
// alert($scope.res)
}
In ur html it should be like this
<ng-csv-import class="import" content="csv.content" header="csv.header" header-visible="csv.headerVisible" separator="csv.separator" separator-visible="csv.separatorVisible" result="csv.result" encoding="csv.encoding" encoding-visible="csv.encodingVisible" callback="csvCallback">
Calback is simply not doing anything... @nainyshah Do you have working example?
@srokatonie This code is copied from the project I am working on .......and it works perfectly.
@nainyshah turned out I am using outdated (2015) package that was available on npmjs... I build npm package with the most recent version of this repo if anyone needs it: https://www.npmjs.com/package/angular-csv-import-recent
However I noticed when debugging that callback
is called many more times, not only when it finishes processing or setting is changed...
Hi,
Getting below error when running with angular 1.5.8.
Error: scope.callback is not a function .link/</reader.onload/</<@http://192.168.56.101:9000/bower_components/angular-csv-import/dist/angular-csv-import.js:68:8 $RootScopeProvider/this.$get</Scope.prototype.$digest@http://192.168.56.101:9000/bower_components/angular/angular.js:16789:13 $RootScopeProvider/this.$get</Scope.prototype.$apply@http://192.168.56.101:9000/bower_components/angular/angular.js:17003:13 .link/</reader.onload@http://192.168.56.101:9000/bower_components/angular-csv-import/dist/angular-csv-import.js:58:6
http://192.168.56.101:9000/bower_components/angular/angular.js Line 13294