AngularJS什么呢当地人指令立场 [英] AngularJS what does locals in directive stand for

查看:87
本文介绍了AngularJS什么呢当地人指令立场的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AFAIK这是没有记录,但我在角源中找到一个指令例如当地人属性:

AFAIK this is not documented, but I found in angular source a locals attribute in a directive example:

angular.module('transclude', [])
          .directive('pane', function(){
             return {
               restrict: 'E',
               transclude: true,
               scope: 'isolate',
               locals: { title:'bind' },
               template: '<div style="border: 1px solid black;">' +
                           '<div style="background-color: gray">{{title}}</div>' +
                           '<div ng-transclude></div>' +
                         '</div>'
             };
         });

这是什么呢?我如何使用它?

What does it do? How can I use it?

更precise:

如何访问当地人的指令控制器或链接 ING功能?

How can I access locals from directive's controller or linking function?

如何动态地更改当地人的控制器或指令链接 ING功能?

我可以使用当地人在每一个指令,或者它必须以 transclude = TRUE

Can I use locals in every directive, or does it have to be a directive with a transclude=true ?

推荐答案

我只是想关闭这个问题。
因此,答案是一样@ArunPJohny说

I just want to close this question. So the answer is like @ArunPJohny said

@param {对象=} 当地人(可选对象)。

@param {Object=} locals (Optional object).

如果preSET那么任何参数名称是从该对象读第一, $喷油器之前被咨询

If preset then any argument names are read from this object first, before the $injector is consulted

这篇关于AngularJS什么呢当地人指令立场的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆