Controller Script vs CFML

Not quite sure why a script controller works and the same code in CFML doesn’t.

I’m getting the following error with this CFML controller: Error Messages: Variable USERSERVICE is undefined.

`

`

…but no error with this script version:

`
component{

property name=“userService” inject=“UserService”;

//<!------------------------------------------- PUBLIC EVENTS ------------------------------------------>

function doLogin(event,rc,prc){

rc = event.getCollection();
var q = userService.getLogin(rc.username);
rc.response = q;
event.setView(“login”);
}

//<!------------------------------------------- PRIVATE EVENTS ------------------------------------------>

}
`

What gives?
Any help is appreciated.
-CK

Instance.UserService

Your first one is injecting into the instance scope, so you would need instance.userservice or just inject into the variables scope.

Curt

Got it. If I remove the scope, I can just reference the userService by itself. Thank you.

-CK