UI.Bootsrap与AngularJS密码匹配冲突
问题如下:我有一个完整的angularjs密码匹配代码:UI.Bootsrap与AngularJS密码匹配冲突,angularjs,angularjs-scope,angular-ui-bootstrap,Angularjs,Angularjs Scope,Angular Ui Bootstrap,问题如下:我有一个完整的angularjs密码匹配代码: var app = angular.module('ngMatch', []); app.directive('match', function () { return { require: 'ngModel', restrict: 'A', scope: { match: '=' },
var app = angular.module('ngMatch', []);
app.directive('match', function () {
return {
require: 'ngModel',
restrict: 'A',
scope: {
match: '='
},
link: function(scope, elem, attrs, ctrl) {
scope.$watch(function() {
var modelValue = ctrl.$modelValue || ctrl.$$invalidModelValue;
return (ctrl.$pristine && angular.isUndefined(modelValue)) || scope.match === modelValue;
}, function(currentValue) {
ctrl.$setValidity('match', currentValue);
});
}
};
});
但为输入时的工具提示添加ui.bootstrap:
<input id="password" type="password"
tooltip="Your password should contain at least one digit, one capital and special symbol, should have the length from 8 to 20 symbols"
tooltip-trigger="focus"
tooltip-placement="top"
class="form-control"
name="password" value="" placeholder="Password"
ng-model="password"
pattern="(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$"
minlength="8" maxlength="20"
required>
<input id="confirm-password" type="password" class="form-control" name="confirm_password" value="" placeholder="Confirm Password" ng-model="confirm_password" data-match="password" required>
我们是否真的使用它并不重要,但当它被添加时,我们会得到一些没有“匹配”变量的其他“范围”,原因不明
我们能做些什么使我们的作用域更加孤立?
非常感谢您的帮助,我已经花了7个多小时试图解决此冲突…在您的示例中,我看不出您在哪里使用此指令?
angular.module('ModuleName', [
'ui.router',
...
'vcRecaptcha',
'ui.bootstrap'
])