@ AjayBeniwal's answer is correct, but I feel that he can use some further explanation.
As the Angular documentation points out (in the section "Insulating a Directive's Scope"), the scope parameter is an object that contains a property for each binding of the isolation scope. We use it to separate (isolate) the area inside the directive from the outside area and then map the outside area to the inside area of ββthe directive.
The name of each property of the scope object corresponds to the isolate scope directives. In the sample question, the only property of the scope object is listcolumns . Because of this, html must also have a corresponding attribute that creates the directive:
<div linkedlist listcolumns="cashAccountsColumns"></div>
However, the name of the scope property and attribute of the directive should not have the same name. We can match these two values ββas follows:
<div linkedlist short-name="cashAccountsColumns"></div>
-
controller: function ($scope) { $scope.cashAccountsColumns = 'value'; }, scope: { moreDescriptiveName: "=shortName" },
In cases where the attribute name matches the value that you want to bind within the scope of the directive, you can use this shorthand syntax:
<div linkedlist my-name="cashAccountsColumns"></div>
-
controller: function ($scope) { $scope.cashAccountsColumns = 'value'; }, scope: { myName: "=" },
In addition, in this example, the value of the attribute of the directive should correspond to the property of the external area of ββthe directive. This is due to the fact that = in =shortName uses bi-directional binding of attributes from the external area to the selection area, causing the value of the directive attribute to be evaluated as an expression. As this answer eloquently indicates, if we just want to pass a literal string, we can either use @ instead of = , or disrupt the selection of the scope directive with double and single quotes:
scope: { moreDescriptiveName: "@" },
OR
<div linkedlist short-name="'cashAccountsColumns'"></div>