<form action="/somewhere/" method="POST" required>
<input type="text" id="myTextbox" />
<div class='error'>
field is required
</div>
<input type="submit" />
</form>
.error {
display: none;
}
#myTextbox:invalid + .error {
display: block;
}
var promise = $http.get('data/category.json');
promise
.then(
function(data){
$scope.category = data
},
function(error) {
console.log(error);
}
);
promise.then(function1).then(function2).then(function3)
link: function postLink(scope, element, attrs, ctrl) {
var ngModel = ctrl;
element.bind('blur', function () {
// здесь можно получить параметры из ngModel через методы ngModelController
});
}
while (Boolean(--n) === true) {
console.log(n);
}
var def = {
handlers: [],
when : function (func) {
console.log ('start async');
func.call(def, def.done);
waiter();
function waiter() {
setTimeout (function () {
if (def.result) {
def.resolve(def.result);
}
else {
waiter();
}
}, 500);
}
return def;
},
resolve: function(result) {
console.log('start resolving');
var _result = result;
def.handlers.forEach(function(handler) {
_result = handler(result);
});
def.result = _result;
},
then : function (func) {
def.handlers.push(func);
return def;
},
done : function (result) {
def.result = result;
}
};
'libs/jquery/dist/jquery.js',
'libs/jquery/dist/jquery.min.js',