In order to solve your problem, what we want to be able to do is separate the scope inside a directive from the scope outside, and then map the outer scope to a directive's inner scope. This can be accomplished using an isolate scope. To do this, we will add a scope property to our directive object:
scope: {
item: '=item'
}
Our full directive might now look something like this:
myApp.directive('listItemMulti', function($log) {
return {
restrict: 'E',
link: function(scope, elem) {
var length = scope.item.length;
...
},
scope: {
item: '=item'
}
}
});
This can be used in our html like this:
<div ng-controller="SampleCtrl">
<list-item-multi ng-repeat="whatever in items" item="whatever">
</list-item-multi>
</div>
What we are doing here is designating a variable in our directive that we can bind to when we use our directive in our html. Here we've added the variable item. This can now be assigned to by using the variable name as an html attribute on our custom element. Notice how we've assigned whatever to the attribute item. Now, within our link function, our scope variable will contain the value that item was bound to. This allows us to designate specific variables that we want to be visible within out directive, but also provides an extra layer of indirection that prevents our code from being brittle. We can now change the name of the outside variable to whatever we feel like without needing to change anything within our directive.
Also, notice that I have renamed your directive to listItemMulti instead of ngListItemMulti. The ng prefix of directives is a convention specific to the built in angular directives. You should avoid using this prefix in your custom directives so that you can prevent any accidental naming conflicts that might occur. Often, it is best practice to give all your directives some standard prefix that relates to the name of the application. For instance, if I was developing an app for Stack Overflow, I might prefix all my directives with so.
Here is a plnkr with a working example: http://plnkr.co/edit/BdtWcuUz34GxhkrKWCwS?p=preview
The documentation on directives, and specifically isolate scope can be found here: https://docs.angularjs.org/guide/directive. (ctrl+f "Isolating the Scope of a Directive").
Hope this helps :-)