Javascript 在AngularJS中创建动态指令

Javascript 在AngularJS中创建动态指令,javascript,angularjs,angularjs-directive,directive,Javascript,Angularjs,Angularjs Directive,Directive,我希望,当我单击指令中的某个元素时,使用该元素的详细信息调用其他指令 实际上,当我在元素中单击时,会调用该指令,但不会显示信息,因为我要在((鉴定细节))指令中显示的对象在此范围内未定义 (功能(应用程序){ 附录指令(“证明”,功能(){ 返回{ restric:“E”, 范围:{ 信息:'=' }, 控制器:函数($scope,$http){ $scope.index=0; $scope.showDetail=false; var数量=3; var信息=0; $http.get(“/Tes

我希望,当我单击指令中的某个元素时,使用该元素的详细信息调用其他指令

实际上,当我在元素中单击时,会调用该指令,但不会显示信息,因为我要在((鉴定细节))指令中显示的对象在此范围内未定义

(功能(应用程序){
附录指令(“证明”,功能(){
返回{
restric:“E”,
范围:{
信息:'='
},
控制器:函数($scope,$http){
$scope.index=0;
$scope.showDetail=false;
var数量=3;
var信息=0;
$http.get(“/Testimonio/getTestimonials/”).success(函数(数据){
$scope.commentials=data.data;
information=data.data.length;//获取所有数据时,淡出预加载gif
美元(“.se pre con”)。淡出(“缓慢”);
});
//显示项目的限制
$scope.quantity=3;
$scope.setTestimonial=函数(值){
数量+=价值;
如果(值==0){
数量=3;
window.location.hash=“证明”;
}
$scope.quantity=数量;
}
//核实是否有更多的证明要展示
$scope.ISMOREESTIONAL=函数(){
退货信息>数量;
}
$scope.viewTestionalDetail=函数(信息){
$scope.CertificationDetail=info;//问题出在这里。。此对象未在html中设置。
$scope.showtail=true;
};               
},
templateUrl:'App/Directives/Views/commissionals.html',
}
});
}(角模块(“应用”))

睾丸
{{证词.日期|日期}
{{emission.Description}showShortString:220}

弗马斯。 弗梅诺斯。
像这样的东西

var addElement = function(directive,scope){
   var element = $compile(directive)(scope);  // compile the new element
   angular.element(document.getElementById('my-id')).after(element);  // add html to the dom
  } 
其中指令是指令的html。 我知道这对你很有用