2
我正在使用angular和firebase製作應用。我想要實現angular-trix編輯器,以便用戶可以發佈他們自己的文章。但我不知道如何整合angular-trix。我已經包含了js文件,並在app.js中注入了'angularTrix'。 var app = angular.module('myApp', ['ngRoute', 'ui.bootstrap', 'ngAnimate', 'firebase', 'ngSanitize','angularTrix']);
這是我的HTML頁面。將angular-trix添加到angularjs firebase應用
<div>
<trix-editor ng-model="trix" angular-trix></trix-editor>
<button ng-click="save()">Save!</button></div>
,這是控制器
app.controller('profileCtrl', ['$scope', "$routeParams", "$firebaseObject", "$sce", "Auth", function($scope, $firebaseObject, $routeParams, $rootScope, Auth, $sce) {
// Demo controller
console.log('In ctrl');
$scope.trix = '<p>Hello</p>';
$scope.save = function() {
alert($scope.trix);
};}]);
我不知道我有一個控制器包含。我希望當用戶按提交按鈕時,它應該提取HTML並將其保存到Firebase。
我知道如何將數據保存在firebase中,但不知道如何從AngularTrix中提取HTML。
控制器的一段代碼會有很大的幫助。
這不起作用。沒有任何內容顯示在頁面上。 –
我的演示不工作? –
它只是顯示一個沒有數據的小盒子。 –