我有一个看起来像的输入字段
<input class="inputMargin urlInputWidth" type="text" size="40" name="url" ng-model="user.customerId" maxlength="250" ng-pattern="/sftp://.+/" />
它工作正常并按预期显示验证。我只是想将这种模式移动到 angularjs 的范围内以获得更整洁的形式。我已经尝试过使用这种语法:$scope.sftpValidate="/sftp://.+/";
和ng-pattern="sftpValidate"
. 但这根本不能验证模式。我试图给 as$scope.sftpValidate=/sftp://.+/;
和$scope.sftpValidate=sftp://.+;
。但这些显示语法错误。我在哪里失踪?