1
我不能將斷行文本保存到我的數據庫中,如何解決這個問題?Angular - 斷行文本
我保存假設是這樣
I want to ask something.
Can I?
不喜歡這個
I want to ask something. Can I?
HTML
<textarea name="" cols="" rows="" class="form-control" ng-model="rule.message" required></textarea>
<button type="submit" class="btn btn-default" ng-click="create()">Save</button>
JS數據
myControllers.controller('MemberRuleCreateCtrl', ['$scope', '$location',
'$http',
function($scope, $location, $http) {
$scope.rule = {};
$scope.create = function() {
$http({
method: 'GET',
url: 'http://xxxxx.my/api/create_rule.php?&message=' + $scope.rule.message
}).
success(function(data, status, headers, config) {
alert("Rule successful created");
$location.path('/member/rule');
}).
error(function(data, status, headers, config) {
alert("No internet connection.");
});
}
}
]);
請指教。謝謝。
這消息應該包含'\ n \ N'字符,如果有換行符 – tymeJV 2014-10-07 23:23:27