0
我對AngularJS非常新穎。我試圖顯示角度JS中彈出的模式。 我已經嘗試了對角線對話框演示教程中的按鈕單擊模式。在頁面加載時,檢查一個條件並在Angular JS中彈出模態彈出
我現在需要的是,在頁面加載時,應該檢查一個條件,根據該條件彈出應該顯示。我有個想法,喜歡在頁面加載時自動點擊此按鈕。但我認爲這不是一個好方法。我研究了各種選項,但找不到相關的解決方案。
任何幫助,可以讚賞。
以下是迄今爲止從this演示中已經完成的工作。
HTML:
<div ng-controller="TestCtrl" layout="row" ng-cloak style="height: 300px">
<style>
.edgePadding {
padding-left: 25px;
padding-right: 25px;
}
</style>
<div layout="column" layout-align="center start" layout-padding flex>
<div class="inset"> test test test </div>
<div class="dialog-demo-content" layout="column" layout-align="center center" style="width:100%">
<md-button class="md-primary md-raised edgePadding" ng-click="openFromLeft()" >
test
</md-button>
</div>
app.js
angular.module('mytestapp')
.controller('TestCtrl', function($scope, $mdDialog) {
$scope.openFromLeft = function() {
$mdDialog.show(
$mdDialog.alert()
.clickOutsideToClose(true)
.title('Opening from the left')
.textContent('Closing to the right!')
.ariaLabel('Left to right demo')
.ok('Nice!')
// You can specify either sting with query selector
.openFrom('#left')
// or an element
.closeTo(angular.element(document.querySelector('#right')))
);
};
$scope.openOffscreen = function() {
$mdDialog.show(
$mdDialog.alert()
.clickOutsideToClose(true)
.title('Opening from offscreen')
.textContent('Closing to offscreen')
.ariaLabel('Offscreen Demo')
.ok('Amazing!')
// Or you can specify the rect to do the transition from
.openFrom({
top: -50,
width: 30,
height: 80
})
.closeTo({
left: 1500
})
);
};
})
任何基本方法是讚賞。