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:


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

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

function doLogin(event,rc,prc){

rc = event.getCollection();
var q = userService.getLogin(rc.username);
rc.response = q;

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


What gives?
Any help is appreciated.


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


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