check if var is defined on the view and not on every controller