我有几个问题 :
- 如何将数据加载到角度模态中的内容?
- 如何为任何选定的项目加载自定义数据?.................................................. ...........
这是我的代码:
HTML
<section ng-controller="ServicesController">
<div ng-click="toggleModal()" ng-repeat="item in items" class="col-md-4">
{{ item.name }}
</div>
<modal visible="showModal">
</modal>
</section>
Run Code Online (Sandbox Code Playgroud)
CONTROLLER.JS
myApp.controller('ServicesController', function ($scope) {
$scope.items = [
{
"name": "product1",
"image": "images/img1.jpg",
"id": "1"
},
{
"name": "product2",
"image": "images/img2.jpg",
"id": "2"
},
{
"name": "product3",
"image": "images/img3.jpg",
"id": "3"
},
]
$scope.showModal = false;
$scope.toggleModal = function(){
$scope.showModal = !$scope.showModal;
};
});
myApp.directive('modal', function () {
return {
template: '<div class="modal fade">' +
'<div class="modal-dialog">' …Run Code Online (Sandbox Code Playgroud)