Rewrite show logic using Angular JS