我可以根据输入字符串创建唯一编号(代码/字符串/短哈希)吗?
我需要为每个唯一字符串获取短的唯一编号(不比较现有值)
答案 0 :(得分:2)
您的问题非常模糊,但如果我理解正确,您可以使用哈希,即var app = angular.module('myApp', [])
.controller('MyController', function($scope, $http) {
$scope.collection = [
{name:'foo'},
{name:'bar'},
{name:'foobar'},
{name:'barfoo'},
];
$scope.edit = function(current_name) {
this.myinput = current_name;
console.log(current_name);
}
})
或唯一身份$code = md5($val1 . $val2 . $val3);