我有san
值,如何将此值拆分为三个部分
例如"<HR>*10/100"
和"HR", "*"
HTML
"10/100"
角
<input type='text' ng-model='value' ng-change="GetAngValue(value)">
{{Result}}
使用此代码获取尖括号值,但如何获取剩余的
答案 0 :(得分:0)
这很长的路要走,但它会做到这一点
value.replace("<","").replace(">",",").replace("*","*,").split(",");
答案 1 :(得分:0)
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.21/angular.min.js"></script>
<div ng-app="app" ng-controller="appCtrl">
<input type='text' ng-model='value' ng-change="GetAngValue(value)">
{{Result}}
</div>
<script>
angular.module('app',[]).controller('appCtrl',function($scope){
$scope.GetAngValue = function (value) {
var Matches = value.replace("<","").replace(">",",").replace("*","*,").split(",");
if (Matches) {
$scope.Result = Matches;
}
console.log(Matches);
}
})
</script>
&#13;