如何使用angular-material 1.0.1将参数传递给$ mdToast.show函数中的控制器

Con*_*Lee 5 angularjs angularjs-scope

我正在使用angualr-material并希望将一个参数传递给$mdToast.show()内部控制器,我检查了函数中有一个范围,但我不知道如何编写代码,我尝试了很多表达式,但是没有工作,请帮助我,非常感谢!这是我的代码:

JS:

var test='test for angular';
$mdToast.show({
   templateUrl: 'TemplateView/CustomToast/warning.html',
   controller: 'WarningToastCtrl',
   scope:test 
});

angular.module('app')
   .controller('WarningToastCtrl', ['$scope', function ($scope) {
       $scope.value=test;
   }]);

Html:
<md-toast class="warning-toast">
    <span flex>{{value}}</span>
</md-toast>
Run Code Online (Sandbox Code Playgroud)

问:如何将值显示为测试角度?

Con*_*Lee 6

好的,我刚发现有一个当地人可以使用:

    $mdToast.show({
      templateUrl: 'TemplateView/CustomToast/warning.html',
      controller: 'WarningToastCtrl',
      locals:{parm:test} 
    });
    angular.module('app')
.controller('WarningToastCtrl', ['$scope', 'parm', function ($scope, parm) {
        $scope.showValue = parm;
    }]);
Run Code Online (Sandbox Code Playgroud)