angular.js - $ionicModal conflicts with boostrap
黄舟
黄舟 2017-05-15 16:53:04
0
1
637

Use $ionicModal pop-up model window

After the project introduces boostrap3.3.4, the model window becomes a black modal layer with no animation and no content

The following is the code that you can try. The code is very simple and does not require any special effects. However, it has no effect...

index.html

<link rel="stylesheet" href="lib/bootstrap/bootstrap-3.3.4.min.css">

<body ng-app="starter">
    <ion-nav-view></ion-nav-view>
</body>

home.html

<ion-view>
    <button ng-click='openModal()'>modal</button>
</ion-view> 

modal.html

<ion-modal-view>
    <ion-header-bar class="bar-energized">
        <h1 class="title">ion-modal-view</h1>
        <a class="button" ng-click="closeModal();">关闭</a>
    </ion-header-bar>
    <ion-content>
        Hello!
    </ion-content>
</ion-modal-view>

app.js

app.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
            url: "/home",
            templateUrl: "templates/home.html",
            controller: 'HomeCtrl'
        });
$urlRouterProvider.otherwise('/home');

controller.js

app.controller('HomeCtrl', function($scope, $state, $ionicModal) { 
   $ionicModal.fromTemplateUrl("templates/model.html", {
        scope: $scope,
        animation: "slide-in-up"
    }).then(function(modal) {
        $scope.modal = modal;
    });

    $scope.openModal = function() {
        $scope.modal.show();
    };

    $scope.closeModal = function() {
        $scope.modal.hide();
    };

});
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
巴扎黑

You can only introduce the parts required by bootstrap, such as Grid system, Basic utilities, and Responsive utilities

Reference http://forum.ionicframework.com/t/responsive-grid-layout/707/20

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template