Код: Выделить всё
Add First List
Add Second List
< /code>
, который открывает модальную директиву, и у меня есть два экземпляра по директивности. < /p>
Код: Выделить всё
app.directive('myDivTable',function () {
var controller = ['$scope',function ($scope) {
$scope.AddTempElem =function () {
$scope.datasource.push({startDate: $scope.start, endDate: $scope.end, workInHours: $scope.hours});
}
$scope.Submit = function () {
$scope.directivevarible = $scope.directivevarible.concat( $scope.datasource);
$scope.datasource = [];
}
}],
template=function (tElem,tAtrrs) {
if(tAtrrs.type ==='table'){
return 'template.html';
}
if(tAtrrs.type ==='modal'){
return 'modal.html';
}
}
return{
scope:{
datasource:'=',
directivevarible:'='
},
controller:controller,
templateUrl:template
};
});
Подробнее здесь: https://stackoverflow.com/questions/384 ... -angularjs