Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/460.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript $mdToast显示相同的属性_Javascript_Angularjs_Angular Material - Fatal编程技术网

Javascript $mdToast显示相同的属性

Javascript $mdToast显示相同的属性,javascript,angularjs,angular-material,Javascript,Angularjs,Angular Material,我已经为同时显示两个toast设计了一个mdTast,但是只有操作具有传递的值,其他值保留为第一个toast 看到照片了吗 看到我的代码了吗 var setToaster = function(text,action,url,position) { var toast = $mdToast.simple() .textContent(text) .action(action) .position(

我已经为同时显示两个toast设计了一个mdTast,但是只有操作具有传递的值,其他值保留为第一个toast

看到照片了吗

看到我的代码了吗

      var setToaster = function(text,action,url,position) {
        var toast = $mdToast.simple()
            .textContent(text)
            .action(action)
            .position(position)
            .hideDelay(false)
            .highlightAction(true)
            .highlightClass('md-accent')// Accent is used by default, this just demonstrates the usage.
            // .position(pinTo);

      return  $mdToast.show(toast).then(function (response) {
            if (response == 'ok') {
                $location.url(url);
            }
        });
    };

    var setToaster2 = function(text,action,url,position) {


    if (vm.viewForm == false) {
        setToaster('Your Client History Form still not completed,Please Compelete it', 'Complete', '/client-history', 'top right')
    }


    if (vm.myVar.complete_profile == true) {
       setToaster('Your profile is incomplete, Please Complete your profile', 'Go To Profile', '/user/profile', 'bottom right')
    }

这个函数有什么问题,toast支持这样做吗?

我调用该函数的方式覆盖了以前的调用。我已将其更改为这种方式。它对我有效。希望这对其他人有所帮助

enter code here     if (vm.myVar.complete_profile == false) {
        var message = 'Your profile is incomplete, Please Complete your profile';

        $mdToast.show({
            template: '<md-toast id="profile-message" layout="column" layout-align="center start"><div class="md-toast-content">' + message + '<md-button ui-sref="app.auth_profile">Complete</md-button></div></md-toast>',
            hideDelay: 10000,
            position: 'top right',
            parent: '#content'
        }).then(function(){
            location.url('user/profile')
        });

    }

    if (vm.viewForm == false) {
        var message = 'Your Client History Form still not completed,Please Compelete it';

        $mdToast.show({
            template: '<md-toast id="form-message" layout="column" layout-align="center start"><div class="md-toast-content">' + message + '<md-button ui-sref="app.auth_client-history">Complete</md-button></div></md-toast>',
            hideDelay: 10000,
            position: 'top right',
            parent: '#content'
        }).then(function(){
            location.url('client-history')
        });
    }
如果(vm.myVar.complete\u profile==false),请在此处输入代码{
var message='您的个人资料不完整,请填写您的个人资料';
$mdToast.show({
模板:“”+消息+“完成”,
希德雷:10000,
位置:'右上',
父项:“#内容”
}).然后(函数(){
location.url('user/profile')
});
}
if(vm.viewForm==false){
var message='您的客户历史记录表尚未完成,请完成';
$mdToast.show({
模板:“”+消息+“完成”,
希德雷:10000,
位置:'右上',
父项:“#内容”
}).然后(函数(){
location.url('client-history')
});
}