loopback-component-admin icon indicating copy to clipboard operation
loopback-component-admin copied to clipboard

Type issue

Open allupaku opened this issue 9 years ago • 15 comments

I am getting an error when starting the admin panel ,in the console.

no such type defined for ObjectID Object {type: "ObjectID"}

this is happening in angular.js:13003.. and found that not registering the type of ObjectId with the config provider.

Could you please let me know how can i register that so that it will render every thing properly.?

allupaku avatar Feb 22 '16 07:02 allupaku

it is actually here..

if (_propertyTypes[property.type.toLowerCase()]) { -- > cannot find it in propoertyTypes _this.propertyNames.push(propertyName); propertyConstructor = $injector.get(_propertyTypes[property.type.toLowerCase()]); return _this.properties.push(new propertyConstructor(propertyName, property)); } else { return $log.warn('no such type defined for', property.type, property); }

allupaku avatar Feb 22 '16 07:02 allupaku

https://github.com/BoLaMN/loopback-component-admin/commit/eb49c6e19618fd5906519121e7a6f77a8ebdb988

should fix the warning message, ill try get around to compiling it and publishing.

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

theres still a bit of work todo around types and relations as i have to figure out how they should display in a table and a form view thats universal enough to handle it.

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

Ahh, it is not just the warning , but none of my custom models data is been loaded - actually the resources are not been called at all.. there is some error

TypeError: resource is not a function at new (loopback-admin.js:2085)

allupaku avatar Feb 22 '16 07:02 allupaku

TypeError: resource is not a function at new (loopback-admin.js:2085)

points to the factories not being avaliable that get generated by loopback-sdk-angular any warnings in the console?

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

no warnings in the console.. and the factories are available..

allupaku avatar Feb 22 '16 07:02 allupaku

TypeError: resource is not a function

is looking at https://github.com/BoLaMN/loopback-component-admin/blob/master/src/client/components/data/model.factory.coffee#L17 and the loopback injector is just checking for the factory and returning it https://github.com/BoLaMN/loopback-component-admin/blob/571b555dced70abaa480c03b2da9719100d94f24/src/client/components/common/factories/loopback-injector.coffee

so the only way it would not be a function if it didnt exist? do your model names conform too loopbacks Upper Camel Case (PascalCase) as i know i had issues when i tried to go against the normal with loopback-sdk-angular

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

screen shot 2016-02-22 at 10 40 22 am I think the to lowerCase call also has some thing to do ?

The model names confirm to the PascalCase and it is not very complex .. makes me wonder

allupaku avatar Feb 22 '16 07:02 allupaku

Following up by changing the toLowerCase call in two places there .. i hit another wall

Error: [$injector:unpr] Unknown provider: StringPropertyProvider <- StringProperty http://errors.angularjs.org/1.5.0-rc.0/$injector/unpr?p0=StringPropertyProvider%20%3C-%20StringProperty

allupaku avatar Feb 22 '16 07:02 allupaku

ahh yeah its supposed to be lower case, not infront of my mac so couldnt test it and iphone github isnt the easiest either ;)

ive updated that part. its only a warning thou it shouldnt be stopping the ui from working.

try doing in the console var admin = angular.element(document.querySelector('html')).injector().get('LoopBackAdminConfiguration') then console.log(admin.models); which should show you whats registered

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

you can check out the xhr request for the config.json to the api server aswell which holds what models it loads and the xhr request to loopback-admin.resources.js is what the loopback-angular-sdk has generated, can you check them models exist in both locations?

BoLaMN avatar Feb 22 '16 07:02 BoLaMN

all the models are getting registered.. screen shot 2016-02-22 at 11 01 30 am

Really appreciate your quick response.. but if i can fix all the issues, it will be really helpful for me.. :)

allupaku avatar Feb 22 '16 08:02 allupaku

Odd so on that page clicking the plus button doesn't work but gives that resource isn't a function error? Does it work on the main dashboard view maybe?

BoLaMN avatar Feb 22 '16 08:02 BoLaMN

Its also odd that the route has the model being all lowercase where it maybe should be pascal cased

BoLaMN avatar Feb 22 '16 08:02 BoLaMN

well can the problem because i dont have a plural form defined ?

allupaku avatar Feb 22 '16 09:02 allupaku