0
정말 이온이 새롭고 각성되어 있습니다. 각 img 요소에 클릭 속성을 추가해야합니다. 나는 컴파일 $ 사용하려하지만 난 항상이온 프로젝트에 <img>을 클릭하십시오.
<img src="img/VIyNbAJ8TbeAQQo6Nm3m_Pic1.PNG" style="display: block; width: 100%; height: auto; margin-left: auto; margin-right: auto;">
controllers.js에게
RangeError: Maximum call stack size exceeded
HTML처럼,을 오류가있는 몇 가지 문제가 있었다
.controller('modalCtrl', function($scope, $ionicModal, $compile) {
$ionicModal.fromTemplateUrl('templates/modal.html', {
scope: $scope
}).then(function(modal) {
$scope.modal = modal;
});
$scope.openModal = function (event) {
$scope.modal.show();
$scope.imgUrl = event.target.src;
}
directives.js
.directive('img', function ($compile) {
return {
restrict: 'E',
link: function (scope, element) {
element.attr('ng-click', "openModal($event)");
$compile(element)(scope);
}
};
어떻게 자동으로 모든 이미지를 클릭 할 수 있습니까? 너.
당신을 감사합니다! 도움이된다. – hesusmordino