Here, we require the welcome controller, which gives us access to the controller (located in the foreign directive) in this directive’s linking function through an additional link function parameter - here, welcomeCtrl.

Note: the last parameter, which is the required controller, does not have a required name convention.

Isolate scope

Though the two element directives have different sets of directive attributes, each instance is evaluated sequentially. Since the scope is shared between the two element directives, the welcome directive takes on the form of whichever instance came last.

The solution is to provide the welcome directive with an isolate scope for each instance: