Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.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 将纯角度转换为ecma6加角度_Javascript_Angularjs Directive_Angularjs Scope_Ecmascript 6_Angular Controller - Fatal编程技术网

Javascript 将纯角度转换为ecma6加角度

Javascript 将纯角度转换为ecma6加角度,javascript,angularjs-directive,angularjs-scope,ecmascript-6,angular-controller,Javascript,Angularjs Directive,Angularjs Scope,Ecmascript 6,Angular Controller,我想用eccma脚本代码构建动态控制器。我将用angular代码展示一个示例。但我不明白如何在eccma6中实现这一点 let module = 'app.core.checka'; class WindowViewer{ constructor() { this.restrict = 'E'; this.template = ` < Button ng - click = "sendMsg()" > 85855 < /

我想用eccma脚本代码构建动态控制器。我将用angular代码展示一个示例。但我不明白如何在eccma6中实现这一点

let module = 'app.core.checka';
    class WindowViewer{
        constructor() {

    this.restrict = 'E';
            this.template = ` < Button ng - click = "sendMsg()" > 85855 < /Button><div ng-model="ngModel" kendo-window="windowId" k-title="'AJAX content'"
            k - width = "'90%'" k - height = "'90%'" k - visible = "false" k - draggable = "false"
            k - max - height = "'100%'" k - max - width = "'100%'" k - position = "{top: '10px', bottom: '100px', left: '5%', right: '5%'}"
            k - position - left = "'5%'"
            k - pinned = "true"  k - actions = '[ "Minimize", "Maximize" ,"Close", "Refresh"]'
            k - content = "{url: '{{ content }}' }"
            k - on - open = "win2visible = true" k - on - close = "win2visible = false" > < /div>`;

            this.controller = '@';
            this.name = 'controllerName';
            this.scope = {
            ngModel: '=',
                    content: '=',
                    windowId: '=',
                    minimize: '=',
            }

    }


    link(scope, elm, attrs, ctrl) {
    console.log(scope);
            if (angular.isDefined(scope.ratio)) {
                let ratio = scope.ratio.split(':');
                scope.offset = ratio[0];
                scope.inputWidth = ratio[1];
            }

    }

    static directiveFactory() {
            WindowViewer.instance = new WindowViewer();
            return WindowViewer.instance;
    }

    static callMe(){
      alert(884855);
    }
 }

   angular.module(module, [])
    .directive('windowViewer', WindowViewer.directiveFactory);


    export default module;
let模块='app.core.checka';
类WindowViewer{
构造函数(){
this.restrict='E';
this.template=`
`; this.controller='@'; this.name='controllerName'; 此范围={ ngModel:“=”, 内容:“=”, windowId:“=”, 最小化:“=”, } } 链接(范围、elm、属性、ctrl){ console.log(范围); 如果(定义了角度(范围比)){ let ratio=scope.ratio.split(“:”); scope.offset=比率[0]; scope.inputWidth=比率[1]; } } 静态定向工厂(){ WindowViewer.instance=新建WindowViewer(); 返回WindowViewer.instance; } 静态callMe(){ 警报(884855); } } 角度。模块(模块,[]) .directive(“windowViewer”,windowViewer.directiveFactory); 导出默认模块; =========================================================================

我想在下面的eccmascript 6代码中添加控制器。如果有人能这样做,我将不胜感激,并将为您提供极大帮助。
这是角度代码

  var app = angular.module('myApp',[]).
  directive('communicator', function(){
       return {
       restrict : 'E',
       scope:{},
       template:"<input type='text' ng-model='message'/><input type='button'         
       value='Send Message' ng-click='sendMsg()'><br/>",
       controller : "@",
       name:"controllerName"    
    }   
     }).
     controller("PhoneCtrl",function($scope){
     $scope.sendMsg = function(){
     alert( $scope.message + " : sending message via Phone Ctrl");
   }
   }).
    controller("LandlineCtrl",function($scope){
    $scope.sendMsg = function(){
    alert( $scope.message + " : sending message via Land Line Ctrl ");
 }
 })
var-app=angular.module('myApp',[])。
指令('communicator',函数(){
返回{
限制:'E',
作用域:{},
模板:“
”, 控制器:“@”, 名称:“控制器名称” } }). 控制器(“PhoneCtrl”,函数($scope){ $scope.sendMsg=函数(){ 警报($scope.message+“:通过电话Ctrl发送消息”); } }). 控制器(“固定线路控制”,功能($scope){ $scope.sendMsg=函数(){ 警报($scope.message+“:通过陆地线Ctrl发送消息”); } })

请帮我把这个添加到上面的eccma6课程中。我知道你是个专家

准确地表达你的问题,而不让人们看100行代码,这将使你比令人厌恶的奉承更进一步。非常感谢。如果你能告诉我如何将这些控制器添加到ecma类中,请告诉我。