zoukankan      html  css  js  c++  java
  • 传递参数,封装函数

    .run(['$rootScope', function ($rootScope) {
        $rootScope.alert = function (textContent(参数), toastClass, hideDelay) {
            $mdToast.show(
                $mdToast.simple()
                    .textContent(textContent)(对应参数)
                    .action('ok')
                    .toastClass(toastClass)
                   
    .position('bottom right')
                    .hideDelay(hideDelay || 3000)
            );
        }

     

    self.send = function () {
        homeSvc.postHomeList(self.data.message).then(function (result) {
            $rootScope.alert('Send notifications successfully传递的值的内容 'toast-success')(第一个参数内容必传)
            //传输成功
    $mdToast.show(
             $mdToast.simple()
                .textContent('Send notifications successfully')
                .action('ok')
                .toastClass('toast-success')(使用参数textContent,toastClass,hideDelay传递值中所需要的内容)
                
    .position('bottom right')
                .hideDelay(3000)
             );

       
    }, function (error) {
            $rootScope.alert('Failed to send notification', 'toast-error')
            //传输失败
       
    })

    }
  • 相关阅读:
    HDU5269 字典树
    HDU1664 BFS + 数论 + 剪枝
    HDU1429 BFS + 状态压缩
    HDU1075 字典树 + 字符串映射
    HDU1247 字典树
    UVa 10256(凸包、线段交、点在多边形内)
    UVa 10652(旋转、凸包、多边形面积)
    牛客练习赛43D(贪心)
    牛客练习赛43F(推式子)
    Codeforces 1161B(判断旋转对称)
  • 原文地址:https://www.cnblogs.com/ncloud/p/6768695.html
Copyright © 2011-2022 走看看