1
In this plunkモーダル高さを表示する警告ポップアップを備えた角度UIモーダルがあります。代わりに、空の変数が表示されます。エラーはどこですか?角度UIのモーダル高さのプログラムによる決定
HTML
<div the-modal></div>
Javascriptを
var app = angular.module("app", ['ui.bootstrap']);
app.controller("ctl", function($scope, $compile) {});
app.directive("theModal", function($uibModal, $timeout) {
return {
restrict: "AE",
scope: true,
link: function(scope, element, attrs, ctrl, transclude) {
scope.instance = $uibModal.open({
animation: false,
scope: scope,
template: 'Some Text',
appendTo: element
});
$timeout(function(){
alert("Modal height is: " + element.css("height"));
},500);
}
}
});
'element.css'は要素にCSSプロパティを設定するために使用されますが、 – Zooly
は取得できません。どうすれば高さを取得できますか? – ps0604
これを試してください:https://stackoverflow.com/questions/24673418/angularjs-get-element-attributes-values – Danish