के रूप में मुझे यकीन है कि इस से पहले कहा गया है, लेकिन मैं इस सवाल का जवाब नहीं मिल सकता है कर रहा हूँ।AngularJS पाठ के रूप में <br> प्रतिपादन नहीं है एक नई पंक्ति
मैं एक AngularJS स्क्रिप्ट है कि एक DB से खींच रहा है और उसके बाद सामग्री के लिए प्रतिपादन किया है। सबकुछ ठीक से काम कर रहा है, कुछ जगहों को छोड़कर मैं कुछ शब्दों को उनके बीच नई लाइनों के साथ जोड़ना चाहता हूं।
**in the script.js**
groupedList[aIndex].CATEGORY = existingCategory+'\n'+thisCategory;
groupedList[aIndex].CATEGORY = existingCategory+'<br>'+thisCategory;
अगर मैं ऊपर कोड मैं कुछ भी नहीं दिख रहा है की पहली पंक्ति का उपयोग लेकिन वहाँ redered html में एक नई लाइन नहीं है। अगर मैं दूसरी पंक्ति <br>
पाठ के रूप में प्रदान करने के का उपयोग करें और उत्पादन इस तरह दिखता है:
Instinct<br>Media
बजाय
Instinct
Media
मैं पूरी स्क्रिप्ट पोस्ट कर सकते हैं कि अगर मददगार होगा, लेकिन मैं अनुमान लगा रहा हूँ कुछ आसान है कि मैं बस नहीं देख रहा हूँ।
अद्यतन यहाँ पूर्ण js
function qCtrl($scope, $filter, $http, $timeout){
$scope.getCategories = function(){$http.post('quote.cfc?method=getCategories').success(function(data) { $scope.categories = data; }); }
$scope.getClassifications = function(){$http.post('quote.cfc?method=getClassifications').success(function(data) { $scope.classifications = data; }); }
$scope.getIndustries = function(){$http.post('quote.cfc?method=getIndustries').success(function(data) { $scope.industries = data; }); }
$scope.getKeywords = function(){$http.post('quote.cfc?method=getKeywords').success(function(data) { $scope.keywords = data; }); }
$scope.getSources = function(){$http.post('quote.cfc?method=getSources').success(function(data) { $scope.sources = data; }); }
$scope.getAllQuotes = function(){$http.post('quote.cfc?method=getAllQuotesJoined').success(function(data) { $scope.allQuotes = data; }); }
$scope.initScopes = function(){
$scope.getCategories();
$scope.getClassifications();
$scope.getIndustries();
$scope.getKeywords();
$scope.getSources();
$scope.getAllQuotes();
}
$scope.initScopes();
// SEARCH QUOTES
$scope.filteredQuotes = $scope.allQuotes;
$scope.search = {searchField:''};
$scope.searchQuote = function(){
var filter = $filter('filter');
var searchCrit = $scope.search;
var newlist = $scope.allQuotes;
var groupedList = [];
var idList = [];
newlist = filter(newlist,{TESTQUOTE:searchCrit.searchField});
for(i=0;i<10;i++){
aIndex = idList.contains(newlist[i].TESTIMONIALID);
if(aIndex >= 0){
thisKeyword = newlist[i].KEYWORD;
thisClassification = newlist[i].CLASSIFICATION;
thisCategory = newlist[i].CATEGORY;
existingKeyword = groupedList[aIndex].KEYWORD;
existingClassification = groupedList[aIndex].CLASSIFICATION;
existingCategory = groupedList[aIndex].CATEGORY;
if(thisKeyword != '' && existingKeyword.indexOf(thisKeyword) == -1){
groupedList[aIndex].KEYWORD = existingKeyword+' - '+thisKeyword;
}
if(thisClassification != '' && existingClassification.indexOf(thisClassification) == -1){
groupedList[aIndex].CLASSIFICATION = existingClassification+' \n '+thisClassification;
}
if(thisCategory != '' && existingCategory.indexOf(thisCategory) == -1){
groupedList[aIndex].CATEGORY = existingCategory+'<br>'+thisCategory;
}
} else {
idList.push(newlist[i].TESTIMONIALID);
groupedList.push(newlist[i]);
}
}
$scope.filteredQuotes = groupedList;
}
}
Array.prototype.contains = function (needle) {
for (j in this) {
if (this[j] == needle) return j;
}
return -1;
}
यहाँ एचटीएमएल
<div ng-repeat="q in filteredQuotes" class="well clearfix">
<h3>{{q.TITLE}}</h3>
<div class="row-fluid" style="margin-bottom:5px;">
<div class="span3 well-small whBG"><h4>Classification</h4>{{q.CLASSIFICATION}}</div>
<div class="span3 well-small whBG pipeHolder"><h4>Categories</h4>{{q.CATEGORY}}</div>
<div class="span3 well-small whBG"><h4>Key Words</h4>{{q.KEYWORD}}</div>
<div class="span3 well-small whBG"><h4>Additional</h4>Industry = {{q.INDUSTRY}}<br>Source = {{q.SOURCE}}</div>
</div>
<div class="well whBG">{{q.TESTQUOTE}}</div>
<div class="tiny">
Source comment : {{q.SOURCECOMMENT}}<br>
Additional Comment : {{q.COMMENT}}
</div>
</div>
</div>
शायद यह टेक्स्ट कोड – Shmiddty
के रूप में 'CATEGORY' आउटपुट कर रहा है, मुझे लगता है कि यह सच है, क्या टेक्स्टनोड में एक नई लाइन प्राप्त करने का कोई तरीका है? – Lance
तो मुझे लगता है कि हमें कम से कम बाध्यकारी को सेट अप करने की आवश्यकता होगी। – Shmiddty