[英]interface disappears when TinyMCE is added to module
因此,我正在一個Angular-fullstack
項目中嘗試將ui-TinyMCE
添加到我的項目中。 但是當我改變
angular.module('academiaUnitateApp')
.controller('NewEntryCtrl', function ($http, $scope, $stateParams, entryService, Auth) {
$scope.entry = {};
});
成
angular.module('academiaUnitateApp', ['ui-tinymce'])
.controller('NewEntryCtrl', function ($http, $scope, $stateParams, entryService, Auth) {
$scope.entry = {};
$scope.tinymceOptions = {};
});
我的界面從
成
我究竟做錯了什么?
我的HTML
看起來像這樣
<div>
<h1>
New chapter
</h1>
<form class="form" name="form" ng-submit="save(form)" novalidate>
<div class="form-group">
<label class="sr-only" for="title">Title</label>
<input class="form-control" name="title" type="text" placeholder="enter title here" required ng-model="entry.title" />
</div>
<div class="form-group">
<select required ng-model="entry.language">
<option disabled>Choose language</option>
<option ng-repeat="e in languages" value="{{e._id}}">{{e.name}}</option>
</select>
</div>
<div class="form-group">
<label class="sr-only" for="content">Content</label>
<textarea ui-tinymce="tinymceOptions" ng-model="entry.content" id="textarea" name="content" ></textarea>
</div>
<button type="submit" class="btn btn-success" id="save-btn"><span class="glyphicon glyphicon-ok"></span> Save</button>
</form>
</div>
<hr>
<div>
<h1>{{entry.title}}</h1>
<br/>
{{entry.content}}
</div>
我將tinymce添加到我的Bower的依賴項中。
bower.json
{
"name": "academia-unitate",
"version": "0.0.0",
"dependencies": {
"angular": ">=1.2.*",
"json3": "~3.3.1",
"es5-shim": "~3.0.1",
"jquery": "~1.11.0",
"bootstrap": "~3.1.1",
"angular-resource": ">=1.2.*",
"angular-cookies": ">=1.2.*",
"angular-sanitize": ">=1.2.*",
"angular-bootstrap": "~0.11.0",
"font-awesome": ">=4.1.0",
"lodash": "~2.4.1",
"angular-socket-io": "~0.6.0",
"angular-ui-router": "~0.2.10",
"angular-ui-tinymce": "*"
},
"devDependencies": {
"angular-mocks": ">=1.2.*",
"angular-scenario": ">=1.2.*"
}
}
['ui-tinymce']
應為['ui.tinymce']
我也認為您將ui.tinymce
添加到錯誤的位置。 似乎您是在重新創建模塊,而不是在檢索。 參見https://docs.angularjs.org/guide/module#creation-versus-retrieval 。
對於有角度的全棧,您的/client/app/app.js
具有:
angular.module('demoApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'btford.socket-io',
'ui.router',
'ui.bootstrap'
])
您應該在此處添加ui.tinymce
。
angular.module('demoApp', [
'ngCookies',
'ngResource',
'ngSanitize',
'btford.socket-io',
'ui.router',
'ui.bootstrap',
'ui.tinymce'
])
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.