Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.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
用于语法突出显示的angularjs模块/指令_Angularjs_Angularjs Directive_Angular Ui - Fatal编程技术网

用于语法突出显示的angularjs模块/指令

用于语法突出显示的angularjs模块/指令,angularjs,angularjs-directive,angular-ui,Angularjs,Angularjs Directive,Angular Ui,我正在寻找一个好的angularjs模块/指令 用于语法突出显示(js和整个html页面)。 我发现 这是好的,但它切断了ie <!DOCTYPE html> <html ng-app> <head> <title>Simple app</title> <script src="https://ajax.googleapis.com/ajax/libs/ang

我正在寻找一个好的angularjs模块/指令 用于语法突出显示(js和整个html页面)。 我发现 这是好的,但它切断了ie

<!DOCTYPE html>
    <html ng-app>
        <head>
            <title>Simple app</title>
            <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
        </head>
        <body>
            <input ng-model="name" type="text" placeholder="Your name">
            <h1>Hello {{ name }}</h1>
        </body>
    </html>

简单应用程序
你好{{name}
DOCTYPE html头和体

你知道有什么工具可以像上面那样突出显示整个html页面吗

有一个有棱角的包装纸吗

结束
使用

我在当天为我的工作做了一个

它确实需要谷歌美化代码才能工作。如果它适合你,就玩它

angular.module('myModule').directive('code',[function(){
var dir = {};
dir.scope = {
    plunk: '@'
};
dir.restrict = 'E';
dir.template = '<div class="ed-code clearfix"><pre class="prettyprint"></pre><a ng-href="{{plunk}}" target="_blank"><i class="code-link fa fa-toggle-down fa-2x" title="View in Plnkr"></i></a></div>';
dir.transclude = true;
dir.link = function(scope, elem, attr, ctrl, transclude) {
    var code = angular.element('<div>').append(transclude());
    code = code.html().indexOf('<span class="ng-scope">') != -1 ? code.find('span').html() : code.html();
    code = code.replace(/</g,"&lt;").replace(/>/g,"&gt;");
    elem.find('pre').append(prettyPrintOne(code.replace(/ ng-scope/g,"").replace(/ class="ng-scope"/g,"").replace(/\t/g,"").replace(/</g,'&lt;').replace(/>/g,'&gt;')));
};
return dir;
}])
angular.module('myModule')。指令('code',[function(){
var dir={};
目录范围={
砰的一声:'@'
};
dir.restrict='E';
dir.template='';
dir.transclude=true;
dir.link=函数(作用域、元素、属性、控制、转移){
var code=angular.element(“”).append(transclude());
code=code.html().indexOf(“”)!=-1?code.find('span').html():code.html();
code=code.replace(//g,“”);
元素find('pre').append(prettyPrintOne(code.replace(/ng scope/g,”).replace(/class=“ng scope”/g,”).replace(/\t/g,”).replace(/g,”));
};
返回目录;
}])

发了一篇关于它的帖子

谢谢,我试试看。顺便说一句,edLoad非常聪明和酷,我抓到了:)我已经更新了我的帖子,添加了一个结果的屏幕截图,因为你可以看到doctype等仍然被切断:(该死。很抱歉。我用它做的大多数事情都有效。不过很高兴你喜欢它。哈哈