Javascript context in controller