updated viewDirective to support non-child DOM element