最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

AngularJS全局警告框?qū)崿F(xiàn)方法示例

 更新時間:2017年05月18日 08:52:39   作者:timelessmemoryli  
這篇文章主要介紹了AngularJS全局警告框?qū)崿F(xiàn)方法,結(jié)合實例形式分析了AngularJS全局警告框的實現(xiàn)步驟與相關(guān)操作技巧,需要的朋友可以參考下

本文實例講述了AngularJS全局警告框?qū)崿F(xiàn)方法。分享給大家供大家參考,具體如下:

<!DOCTYPE html>
<html lang="zh-CN">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="bootstrap.min.css" rel="external nofollow" >
  <script src="jquery.min.js"></script>
  <script src="angular.js"></script>
  <script src="angular-animate.js"></script>
  <script src="bootstrap.min.js"></script>
  <script type="text/javascript">
    var myapp = angular.module('myapp', ['ngAnimate']);
    myapp.controller('msgController', ['$scope', 'notificationService', function($scope, notificationService) {
      $scope.msg = notificationService;
      $scope.show = function() {
        notificationService.danger('success');
      }
    }]);
    myapp.controller('controller', ['$scope', 'notificationService', function($scope, notificationService) {
      $scope.show = function() {
        notificationService.info('info');
      }
    }]);
    myapp.directive('msgBox', function() {
      return {
        restrict : 'EA',
        scope : {
          content: '@',
          type: '@',
        },
        templateUrl : 'tmpl.html',
        link : function(scope, elem, attrs) {
          scope.close = function() {
            scope.content = '';
          };
        }
      };
    });
    myapp.factory('notificationService', function($timeout, $rootScope) {
      return {
        content : '',
        type : '',
        success : function(content) {
          this.tmpl(content, 'success')
        },
        info : function(content) {
          this.tmpl(content, 'info')
        },
        warning : function(content) {
          this.tmpl(content, 'warning')
        },
        danger : function(content) {
          this.tmpl(content, 'danger')
        },
        tmpl : function(content, type) {
          this.content = content;
          this.type = type;
          var _self = this;
          $timeout(function() {
            _self.clear();
          }, 5000);
        },
        clear : function() {
          this.content = '';
          this.type = '';
        }
      };
    });
  </script>
  <style type="text/css">
    .msg-box {
      z-index: 666;
      position: absolute;
      width: 100%;
      top: 5px;
    }
    .msg.ng-enter {
      transition: 2s linear all;
      opacity: 0.3;
    }
    .msg.ng-enter-active {
      opacity: 1;
    }
    .msg.ng-leave {
      transition: 2s linear all;
      opacity: 1;
    }
    .msg.ng-leave-active {
      opacity: 0;
    }
  </style>
 </head>
 <body ng-app="myapp" ng-controller="msgController">
   <msg-box content="{{msg.content}}" type="{{msg.type}}" class="msg-box">
   </msg-box>
   <h1>content</h1>
   <button type="button" class="btn btn-primary" ng-click="show()">success</button>
   <div ng-controller="controller">
    <button type="button" class="btn btn-primary" ng-click="show()">info</button>
   </div>
 </body>
</html>

<div class="alert alert-{{type || 'info'}} msg" role="alert" ng-if="content">
 <button type="button" class="close" aria-label="Close" ng-click="close()">
  <span aria-hidden="true">&times;</span>
 </button>
 {{content}}
</div>

更多關(guān)于AngularJS相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《AngularJS指令操作技巧總結(jié)》、《AngularJS入門與進階教程》及《AngularJS MVC架構(gòu)總結(jié)

希望本文所述對大家AngularJS程序設(shè)計有所幫助。

相關(guān)文章

  • 詳解Angular6學習筆記之主從組件

    詳解Angular6學習筆記之主從組件

    這篇文章主要介紹了詳解Angular6學習筆記之主從組件,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-09-09
  • AngularJS基礎(chǔ) ng-class-odd 指令示例

    AngularJS基礎(chǔ) ng-class-odd 指令示例

    本文主要介紹AngularJS ng-class-odd 指令,這里對ng-class-odd基礎(chǔ)知識做了詳細整理,并有示例代碼和效果圖,學習AngularJS的同學可以參考下
    2016-08-08
  • AngularJS入門教程之路由機制ngRoute實例分析

    AngularJS入門教程之路由機制ngRoute實例分析

    這篇文章主要介紹了AngularJS入門教程之路由機制ngRoute,結(jié)合實例形式分析了AngularJS路由機制的原理、ngRoute的組成、配置、參數(shù)與相關(guān)使用技巧,需要的朋友可以參考下
    2016-12-12
  • angularjs使用directive實現(xiàn)分頁組件的示例

    angularjs使用directive實現(xiàn)分頁組件的示例

    本篇文章主要介紹了angularjs使用directive實現(xiàn)分頁組件的示例,具有一定的參考價值,有興趣的可以了解一下。
    2017-02-02
  • AngularJS基礎(chǔ) ng-include 指令示例講解

    AngularJS基礎(chǔ) ng-include 指令示例講解

    本文主要介紹AngularJS ng-include 指令,這里對ng-include 指令的知識做了詳細整理介紹,有需要的朋友可以參考下
    2016-08-08
  • AngularJS學習筆記之ng-options指令

    AngularJS學習筆記之ng-options指令

    ng-options是angular-1.3新出的一個指令,這篇文章就來介紹這個指令的用法.有需要的小伙伴可以參考下。
    2015-06-06
  • ng-alain表單使用方式詳解

    ng-alain表單使用方式詳解

    這篇文章主要介紹了ng-alain表單使用方式詳解,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07
  • AngularJS折疊菜單實現(xiàn)方法示例

    AngularJS折疊菜單實現(xiàn)方法示例

    這篇文章主要介紹了AngularJS折疊菜單實現(xiàn)方法,結(jié)合完整實例形式分析了AngularJS實現(xiàn)折疊菜單的具體步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2017-05-05
  • AngularJS HTML編譯器介紹

    AngularJS HTML編譯器介紹

    這篇文章主要介紹了AngularJS HTML編譯器介紹,AngularJS的HTML編譯器能讓瀏覽器識別新的HTML語法。它能讓你將行為關(guān)聯(lián)到HTML元素或者屬性上,甚至能讓你創(chuàng)造具有自定義行為的新元素,需要的朋友可以參考下
    2014-12-12
  • AngularJs 國際化(I18n/L10n)詳解

    AngularJs 國際化(I18n/L10n)詳解

    本文主要介紹AngularJs 國際化的知識,這里整理了詳細的資料來講解國際化,有需要的小伙伴可以參考下
    2016-09-09

最新評論

镇宁| 商都县| 东宁县| 九寨沟县| 南昌县| 黔东| 巩义市| 长子县| 桃园县| 翼城县| 延津县| 竹山县| 湟源县| 册亨县| 米脂县| 恩施市| 蕲春县| 青海省| 申扎县| 镇雄县| 浑源县| 蒙自县| 罗田县| 隆化县| 邢台县| 康定县| 涞源县| 浦县| 天门市| 西乌珠穆沁旗| 论坛| 烟台市| 普宁市| 乌鲁木齐市| 许昌县| 马公市| 阿图什市| 保山市| 进贤县| 尉氏县| 子洲县|