Skip to content

ioc.make("App/Controllers/Http/Admin/UserController") return fun not obj #1188

@ghost

Description

Prerequisites

We do our best to reply to all the issues on time. If you will follow the given guidelines, the turn around time will be faster.

  • Lots of raised issues are directly not bugs but instead are design decisions taken by us.
  • Make use of our forum, or discord server, if you are not sure that you are reporting a bug.
  • Ensure the issue isn't already reported.
  • Ensure you are reporting the bug in the correct repo.

Delete the above section and the instructions in the sections below before submitting

Package version

"version": "4.1.0",
"adonis-version": "4.1.0",

Node.js and npm version

nodejs v12.14.0
npm 6.13.4

Sample Code (to reproduce the issue)

UserController.js

'use strict'
class UserController {
index(){
return 1;
}
}
module.exports = UserController

const { ioc } = require('@adonisjs/fold');
const instance=ioc.make("App/Controllers/Http/Admin/UserController");
console.log('instance ='+instance);
instance'index'

return result:
TypeError
instance['index'] is not a function

instance = UserController {}

But use model ioc.make("App/Models/User"); is ok

BONUS (a sample repo to reproduce the issue)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions