Angularjs 角度指令:从指令到范围的多个值

Angularjs 角度指令:从指令到范围的多个值,angularjs,angularjs-directive,directive,Angularjs,Angularjs Directive,Directive,我想公开从指令到$scope的属性中的多个值。 指令是动态生成的,如下例所示: <my-directive first-value="foo" second-value="bar" third-value="foobar"></my-directive> 我需要$scope中的值,以便将它们提供给模板并使用它们。简单…:-) var-app=angular.module('app',[]); app.controller('myCtrl',函数($scope){}

我想公开从指令到$scope的属性中的多个值。 指令是动态生成的,如下例所示:

<my-directive first-value="foo" second-value="bar" third-value="foobar"></my-directive>

我需要$scope中的值,以便将它们提供给模板并使用它们。

简单…:-)

var-app=angular.module('app',[]);
app.controller('myCtrl',函数($scope){});
app.directive('myDirective',function(){
返回{
限制:'E',
模板:“myDirective:

{{firstValue}},{{secondValue}},{{thirdValue}}”, 范围:{ 第一个值:“@”, 第二个值:“@”, 第三个值:“@” }, } });

var-app=angular.module('app',[]);
应用程序控制器('homeCtrl',函数($scope){
});
app.directive('myDirective',function(){
返回{
限制:“AE”,
模板:“我的指令{firstValue}}}{{secondValue}}}}{{thirdValue}}

”, 范围:{ 第一个值:“@”, 第二个值:“@”, 第三个值:“@” }, 链接:功能(范围、元素、属性){ console.log(scope.firstValue) console.log(scope.secondValue) console.log(scope.thirdValue) } } });