marmelab / ng-admin

Add an AngularJS admin GUI to any RESTful API
http://ng-admin-book.marmelab.com/
MIT License
3.95k stars 725 forks source link

bug with wysiwyg field named "head" #273

Open cvlmtg opened 9 years ago

cvlmtg commented 9 years ago

this is what happens when you edit an entity that have a field named "head":

schermata 2015-02-01 alle 17 21 05

instead of the content of that field you see that snippet of code. in show view you don't see anything but get lots of errors in the js console, like this one:

 TypeError: undefined is not a function
    at a.$inject (http://localhost:3000/public/vendor/ng-admin/ng-admin.min.js:4:5623)
    at http://localhost:3000/public/components/angular/angular.min.js:194:11
    at l.$get.xa.(anonymous function) [as value] (http://localhost:3000/public/components/angular/angular.min.js:59:175)
    at hb.functionCall (http://localhost:3000/public/components/angular/angular.min.js:198:426)
    at Object.<anonymous> (http://localhost:3000/public/components/angular/angular.min.js:108:188)
    at l.$get.l.$digest (http://localhost:3000/public/components/angular/angular.min.js:123:401)
    at l.$get.l.$apply (http://localhost:3000/public/components/angular/angular.min.js:126:471)
    at http://localhost:3000/public/components/angular/angular.min.js:139:187
    at e (http://localhost:3000/public/components/angular/angular.min.js:40:339)
    at http://localhost:3000/public/components/angular/angular.min.js:44:375
TypeError: Cannot read property 'replace' of undefined
    at a.$inject (http://localhost:3000/public/vendor/ng-admin/ng-admin.min.js:4:5622)
    at http://localhost:3000/public/components/angular/angular.min.js:194:11
    at l.$get.xa.(anonymous function) [as value] (http://localhost:3000/public/components/angular/angular.min.js:59:175)
    at hb.functionCall (http://localhost:3000/public/components/angular/angular.min.js:198:426)
    at Object.<anonymous> (http://localhost:3000/public/components/angular/angular.min.js:108:188)
    at l.$get.l.$digest (http://localhost:3000/public/components/angular/angular.min.js:123:401)
    at l.$get.l.$apply (http://localhost:3000/public/components/angular/angular.min.js:126:471)
    at http://localhost:3000/public/components/angular/angular.min.js:139:187
    at e (http://localhost:3000/public/components/angular/angular.min.js:40:339)
    at http://localhost:3000/public/components/angular/angular.min.js:44:375
fzaninotto commented 9 years ago

Yep, I can reproduce it, although with a different error message. The error seems to come from textAngular, a dependency used by ng-admin.

Would you mind opening an issue in their GitHub repo?

cvlmtg commented 9 years ago

ok. btw I'm playing a bit with a custom directive, and I noticed that in the link function, the scope.entry.values objects doesn't contain just the entity values, but a lots of methods, including (guess what :) a method named "head". is this supposed to be correct?

schermata 2015-02-02 alle 23 05 36

fzaninotto commented 9 years ago

You're right, there is something wrong. It's like values gets a copy of the Restangular object... I'll dig deeper.

cvlmtg commented 9 years ago

thanks :)

jeromemacias commented 9 years ago

@fzaninotto Isn't be fixed with https://github.com/marmelab/admin-config/pull/20 ?

fzaninotto commented 9 years ago

I don't see how. Restangular erases data before we can read it.

jpetitcolas commented 8 years ago

On last master version, this bug doesn't seem to happen anymore. Yet, an error is displayed in the console:

angular.min.js:108 TypeError: safe.match is not a function
    at taSanitize (textAngular.js:398)
    at Array._sanitize (textAngular.js:1286)
    at angular.min.js:271
    at n.$digest (angular.min.js:132)
    at angular.min.js:135
    at e (angular.min.js:43)
    at angular.min.js:46