例如我的字符串是Foo Bar. 此字符串应与模式匹配.
如果字符串是Foo bar. 字符串不应该匹配.
如果字符串是Foo Bar Foobar, 则字符串应该匹配
如果字符串是Foo.它也应该匹配.
到目前为止我只有这种模式
(^[A-Z]{1}.*(\s)?$)+
Run Code Online (Sandbox Code Playgroud)
基本上我只接受一个字符串,每个单词的每个首字母都是大写字母
我是移动开发的新手,尤其是使用Ionic.请帮帮我
我的路线有这个代码
.state('auth', {
url: '/auth',
templateUrl: 'templates/login.html',
controller: 'AuthCtrl'
Run Code Online (Sandbox Code Playgroud)
我有这个代码用于我的login.html
<ion-view view-title="Login" name="login-view">
<ion-content class="padding">
<div class="list list-inset">
<label class="item item-input">
<input type="text" placeholder="Mobile Number" ng-model="mobile_number">
</label>
<label class="item item-input">
<input type="password" placeholder="Password" ng-model="password">
</label>
</div>
<button class="button button-block button-calm" ng-click="login()">Login</button>
</ion-content>
Run Code Online (Sandbox Code Playgroud)
并为我的AuthCtrl
.controller('AuthCtrl', function($scope,$auth,$state) {
$scope.login = function() {
var credentials = {
mobile_number : $scope.mobile_number,
password : $scope.password,
}
console.log(credentials);
$auth.login(credentials).then(function(data) {
// If login is successful, redirect to the users state
$state.go('tab.dash', {});
});
}
Run Code Online (Sandbox Code Playgroud)
}) …