Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

"TypeError: exp.trim is not a function" error on chained $http.get callbacks #56

Closed
jochantrelle opened this issue Oct 9, 2015 · 4 comments

Comments

@jochantrelle
Copy link

When chaining success and error callbacks on this.$http.get(...).success(...).error() even with alternate syntax, this.$http.get(...., function(){...}, function(){...}) both callbacks fire. To be clear the ajax call is a success. In the former syntax, the error callback gives 'data' and 'status' as undefined, however 'request' is 'TypeError: exp.trim is not a function'. In the later syntax the message get a little more verbose with a stack trace: Uncaught (in promise) TypeError: exp.trim is not a function.

Futher investigation (clicking thru on the first line of the stack trace) points to this portion of code:

/**

  • Parse an expression into re-written getter/setters.
    *
  • @param {String} exp
  • @param {Boolean} needSet
  • @return {Function}
    */

exports.parse = function (exp, needSet) {

exp = exp.trim()

I am using Vue 0.12.16 and Vue-resource 0.1.16 via npm install and requires; On Laravel 5.1, latest everything else, except Homestead (current 2.7 latest at the time of this comment is 3.0). Just getting started with Vue, love it so far, but its so simple it's overly delicate, like a hollywood blonde. Not sure if this is a bug or if my novice a** is just doing something wrong. Feedback would be lovely.

Cheers!

@amirrustam
Copy link

@jochantrelle this issue was opened a while ago, are you still having troubles?

@sanbeaman
Copy link

sanbeaman commented May 4, 2016

I'm getting same error:

main.js:4838 Uncaught (in promise) TypeError: exp.trim is not a function(…)
I believe it has something to do with my overuse of keyword 'this', i've tried adding .bind(this) but didn't help.
submitForm: function() { console.log('this.event=' + this.event); this.$http.post('/api/events', this.event).then(function(response){ this.$set(this.event, response.data); console.log('event added'); }, function(response) { console.log(response); }); }

@DannyFeliz
Copy link

I have this error too!

@raphcadiz
Copy link

Any feedback on how to fix this. I have this issue too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants