I've fitted nearly all my controllers in bags. The type of controller doesn't make a difference, but the way that you use it does. If your motor has a much higher winding speed than what it has power to achieve, the controller will be giving maximum current all the time, so will overheat. A controller might be rated at 750w, which is the continuous power that it can run without overheating, but it will allow double that power. As an an example, a 15A 6 FET controller with a 201 rpm Q100 will never overheat in a bag, but if you change the motor to a 328 rpm, it will.
If you could give us some idea of what motor you have, what's its maximum speed and the controller you want to use, it would be easier to give more exact advice.