

ons-navigatorタグとons-templateタグを指定するとアラートダイアログが利用できません。

<http://codepen.io/anon/pen/mJxEWN>

[code]

    ons.bootstrap()
    
      .controller('NotificationController', function($scope) {
        $scope.alert = function() {
          ons.notification.alert({
            message: 'An error has occurred!'
          });
        }
    
        $scope.confirm = function() {
          ons.notification.confirm({
            message: 'Are you sure you want to continue?',
            callback: function(idx) {
              switch (idx) {
                case 0:
                  ons.notification.alert({
                    message: 'You pressed "Cancel".'
                  });
                  break;
                case 1:
                  ons.notification.alert({
                    message: 'You pressed "OK".'
                  });
                  break;
              }
            }
          });
        }
    
        $scope.prompt = function() {
          ons.notification.prompt({
            message: "Please enter your age",
            callback: function(age) {
              ons.notification.alert({
                message: 'You are ' + parseInt(age || 0) + ' years old.'
              });
            }
          });
        }
      });
[/code]

[code]

    <link href="https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.3/build/css/onsen-css-components.css" rel="stylesheet" />
    <link href="https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.3/build/css/onsenui.css" rel="stylesheet" />
    <script src="https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.3/build/js/onsenui.min.js"></script>
    <script src="https://cdn.rawgit.com/OnsenUI/OnsenUI/1.3.3/build/js/angular/angular.min.js"></script>
    <ons-navigator var="navigator" page="alert.html"></ons-navigator>
    
    <ons-template id="alert.html">
      <ons-page>
        <ons-toolbar>
          <div class="center">
            Notifications
          </div>
        </ons-toolbar>
    
        <ons-list ng-controller="NotificationController">
          <ons-list-item ng-click="alert()" modifier="tappable">
            Alert
          </ons-list-item>
          <ons-list-item ng-click="confirm()" modifier="tappable">
            Confirm
          </ons-list-item>
          <ons-list-item ng-click="prompt()" modifier="tappable">
            Prompt
          </ons-list-item>
        </ons-list>
      </ons-page>
    </ons-template>
[/code]

教えてください。


CC BY-SA 4.0
2015-07-06T06:25:00.037
12071
2019-12-13T20:08:13.143
2019-12-13T20:08:13.143
32986
10417
question
onsen-ui
<ons-navigator>と<ons-template>を指定したアラートダイアログ