Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/397.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 有棱角的删除根标记上的属性_Javascript_Html_Css_Angularjs - Fatal编程技术网

Javascript 有棱角的删除根标记上的属性

Javascript 有棱角的删除根标记上的属性,javascript,html,css,angularjs,Javascript,Html,Css,Angularjs,我将自己的标记转换为模板: <div> <input /> <span></span> </div> 只需从中删除class=“{{class}}”width=“{{width}”,如下所示: 否。最终版本没有红绿色类的普京值宽度任何数字的普京值,我需要此属性然后制作正确的plnkr。 <!DOCTYPE html> <html ng-app="sr"> <head> <m

我将自己的标记转换为模板:

<div>
    <input />
    <span></span>
</div>
只需从
中删除
class=“{{class}}”width=“{{width}”
,如下所示:




否。最终版本没有红绿色类的
普京值

宽度任何数字的普京值
,我需要此属性然后制作正确的plnkr。
<!DOCTYPE html>
<html ng-app="sr">
<head>
<meta charset="utf-8" />
<title>single root tag</title>
<style>
body {background:gray;}
.red {background:red;}
.green {background:green;}
.yellow {background:yellow;}
</style>
<script src="dhtmlxcommon.js"></script>
<script src="dhtmlxcalendar.js"></script>
</head>
<body>
    <tag class="{{class}}" width="{{width}}" ></tag><br>
    <tag class="{{class}}" width="{{width}}" ></tag><br>
    PutIn value for <b>class</b> <input ng-model="class" />red green<br><br>
    PutIn value for <b>width</b> <input ng-model="width" />any number
<br>    
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.1.3/angular.min.js"></script>
<script>
var myapp = angular.module("sr", []);

myapp.directive('tag', function(){
    return {
      restrict: 'E',
      replace: true,
      transclude: false,
      scope: false,
      template: 
      '<div><input type="text" ng-model="fdg" class="{{class}}" size="{{width}}" ></input><span>text must be here</span></div>'
      ,
        link: function(scope, element, attrs) {
            //element.find('input').attr('attr1', '{{value1}}');
            //element.find('div').removeAttr('class');
            element.removeAttr('class');
            element.removeAttr('width');
        }
    };
});
</script>
</body>
</html>
<tag></tag><br>
<tag></tag><br>