Probably not the best idea since the mealworms may eat anything growing in the terrarium, like bacteria or fungus that you can't see. And that could be bad for your cham. Especially when those left to crawl around start dying and producing more bacteria and grossness for the others to eat. Also they'll probably just hide from your cham or start pupating into beetles and stop wiggling. Better idea would be to put them in a dish or cup in the terrarium so they are contained but still available for your cham to eat. You'll be able to see them so you'll know how much your cham is eating and it's easy to remove them if they die or pupate.
Mealworms have a hard exoskeleton (chitin) which is difficult for chameleons to digest. They should be fed as treats only. My girl loves them but she only occasionally gets a couple of newly moulted white ones. When I had my frst chameleon a superworm got out of the feeding cup and I didn't know and a few weeks later I kept hearing a scratching noise coming from her viv. That damn worm had climbed up and over the polystyrene background and was eating it's way up inside it! I had to take all her plants and stuff out of the viv and it took me ages to get the worm out of it. Mealworms will burrow and hide so letting them roam isn't such a good idea!