set scope attr using key