Qanday i mag'lubiyat qiymati angularJS da ng-takrorlash bilan bog'lanishi mumkin

Bu mening kodim,

 $scope.records = "test,Test1,Test2,test3,test4";

Ushbu qiymati ng-repeat.need ouput-ga o'xshash li tagida bog'lashni xohlayman

 .test
.Test1
.Test2
.Test3
.Test4
1

6 javoblar

Maxsus filtri foydalaning.

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

angular.module('myApp', []);

var app= angular.module('myApp')
app.controller('MyController', MyController);
  app.filter('split', function() {
    return function(input, spliceplace) {
      var spliceplace = spliceplace || ',';

      return input.split(spliceplace);
    } 
  });

function MyController($scope) {

  $scope.records = "test,Test1,Test2,test3,test4";

};
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.10/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyController">
  
  • <!-- OR
  • --> {{record}}
</div>
</div> </div>

2
qo'shib qo'ydi
Xush kelibsiz @GangadharJannu
qo'shib qo'ydi muallif Manikandan Velayutham, manba
AngularJS xususiyatlaridan foydalanishning yaxshi usuli
qo'shib qo'ydi muallif Gangadhar Jannu, manba

Siz split operatorini foydalanishingiz mumkin. stringni , ga bo'linib, ng-takroriyadan foydalanishingiz mumkin

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

angular.module('myApp', []);

angular.module('myApp').controller('MyController', MyController);

function MyController($scope) {

  $scope.records = "test,Test1,Test2,test3,test4";
  $scope.records = $scope.records.split(',');

};
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.10/angular.min.js"></script>
<div ng-app="myApp" ng-controller="MyController">
  
  • {{record}}
</div>
</div> </div>

0
qo'shib qo'ydi

Use ng-bind

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

var app = angular.module("app", []);
app.controller("ctrl", function($scope) {
  $scope.records = ["test", "Test1", "Test2", "test3", "test4"];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app" ng-controller="ctrl">
  
</div>
</div> </div>

0
qo'shib qo'ydi

Please check working plnkr for your requirment http://plnkr.co/edit/cmY8S1nKYDBCa1GvmFh6?p=preview


     


0
qo'shib qo'ydi

Ansingizni toping:

<body>
  <div ng-app="App" ng-controller="mycontroller">
    {{records}} 
{{arrays}}
  • {{array}}
  </div>
  <script type="text/javascript">
  var app = angular.module("App",[]);
  app.controller("mycontroller",function($scope){
      $scope.records = "test,Test1,Test2,Test3,Test4";
      $scope. arrays = $scope.records.split(',');
  })

  </script>
0
qo'shib qo'ydi

birinchi navbatda ushbu qatorni qatorga aylantirishi va keyin ng-repeat ni li dan foydalaning

Iltimos, havolani tekshiring ...

[Please check the link]

http://jsfiddle.net/manojbagale/jm0kvcmt/1/

0
qo'shib qo'ydi
Angular Uzbekistan
Angular Uzbekistan
107 ishtirokchilar

Guruh Angular bo'yicha muloqot qilish uchun ochilgan Sizni qiziqtirsa: @nodejs_uz @react_uz @angular_uz @yiiframework_uz @js_uzb @typescript_uzb @vuejs_uz @ngTashkent @laravel_uz @uzdevgroup Ish o'rinlari @UzDev_jobs

ngTashkent
ngTashkent
77 ishtirokchilar

Правила просты: 1. Не хамить 2. Не хейтить 3. Реакт не нужен Ссылки: https://t.me/angular_ru - старший брат https://t.me/angular_uz - ангулар на узбекском @js_uzb @vuejs_uz @react_uz @nodejs_uz @yiiframework_uz @uzdevgroup @UzDev_Jobs @tasdev_talks