Copy logic from ngTransclude

Copy the logic as much as possible from the ngTransclude directive