TextAngular无法更改工具栏中的按钮

时间:2016-07-11 02:19:54

标签: angularjs

我正在查看以下页面:

https://github.com/fraywing/textAngular/wiki/Customising-The-Toolbar

它表示要更改TextAngular工具栏选项,您需要执行以下操作:

<text-angular ta-toolbar="[['h1','h2','h3'],['bold','italics']]"></text-angular>

我认为我的环境很奇怪,所以我设置了一个Plunker,但是在那里也是如此:

http://plnkr.co/edit/VcLGzFRm9AGF4AC6S7Co?p=preview

Index.html第23行 - 这可以正常使用。

Index.html第26行 - 即使上述文档表明应该这样做,这也不起作用。

有人可以帮我解决这个问题 - 如何选择工具栏中的选项? :/

1 个答案:

答案 0 :(得分:1)

它正常工作,你只需删除$interpolateProvider

var app = angular.module('adminApp', ['textAngular'], function($interpolateProvider) {
    $interpolateProvider.startSymbol('[[');
    $interpolateProvider.endSymbol(']]');
});

变成这样:

var app = angular.module('adminApp', ['textAngular']);

然后你可以使用:

<text-angular ta-toolbar="[['h1','h2','h3'],['bold','italics']]"></text-angular>

代码段正在运作:

var app = angular.module('adminApp', ['textAngular']);
<html ng-app="adminApp">

<head>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" type="text/javascript"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/textAngular/1.5.0/textAngular-rangy.min.js'></script>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/textAngular/1.5.0/textAngular-sanitize.min.js'></script>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/textAngular/1.5.0/textAngular.min.js'></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/textAngular/1.5.1/textAngular.css">
</head>

<body>
  <text-angular ta-toolbar="[['h1','h2','h3'],['bold','italics']]"></text-angular>
</body>

</html>