mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-17 11:11:05 +00:00
reafactor: Rename ng:bind-immediate -> ng:model-instant
This commit is contained in:
parent
139e1b09a9
commit
c4c60c25b4
4 changed files with 9 additions and 9 deletions
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
<div id="sidebar">
|
<div id="sidebar">
|
||||||
<input type="text" ng:model="search" id="search-box" placeholder="search the docs"
|
<input type="text" ng:model="search" id="search-box" placeholder="search the docs"
|
||||||
tabindex="1" accesskey="s" ng:bind-immediate>
|
tabindex="1" accesskey="s" ng:model-instant>
|
||||||
|
|
||||||
<ul id="content-list" ng:class="sectionId" ng:cloak>
|
<ul id="content-list" ng:class="sectionId" ng:cloak>
|
||||||
<li ng:repeat="page in pages | filter:search" ng:class="getClass(page)">
|
<li ng:repeat="page in pages | filter:search" ng:class="getClass(page)">
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ function publishExternalAPI(angular){
|
||||||
ngModel: ngModelDirective,
|
ngModel: ngModelDirective,
|
||||||
ngList: ngListDirective,
|
ngList: ngListDirective,
|
||||||
ngChange: ngChangeDirective,
|
ngChange: ngChangeDirective,
|
||||||
ngBindImmediate: ngBindImmediateDirective,
|
ngModelInstant: ngModelInstantDirective,
|
||||||
required: requiredDirective,
|
required: requiredDirective,
|
||||||
ngRequired: requiredDirective
|
ngRequired: requiredDirective
|
||||||
}).
|
}).
|
||||||
|
|
|
||||||
|
|
@ -1004,22 +1004,22 @@ var ngChangeDirective = valueFn({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc directive
|
* @ngdoc directive
|
||||||
* @name angular.module.ng.$compileProvider.directive.ng:bind-immediate
|
* @name angular.module.ng.$compileProvider.directive.ng:model-instant
|
||||||
*
|
*
|
||||||
* @element input
|
* @element input
|
||||||
*
|
*
|
||||||
* @description
|
* @description
|
||||||
* By default, Angular udpates the model only on `blur` event - when the input looses focus.
|
* By default, Angular udpates the model only on `blur` event - when the input looses focus.
|
||||||
* If you want to update after every key stroke, use `ng:bind-immediate`.
|
* If you want to update after every key stroke, use `ng:model-instant`.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* <doc:example>
|
* <doc:example>
|
||||||
* <doc:source>
|
* <doc:source>
|
||||||
* First name: <input type="text" ng:model="firstName" /><br />
|
* First name: <input type="text" ng:model="firstName" /><br />
|
||||||
* Last name: <input type="text" ng:model="lastName" ng:bind-immediate /><br />
|
* Last name: <input type="text" ng:model="lastName" ng:model-instant /><br />
|
||||||
*
|
*
|
||||||
* First name ({{firstName}}) is only updated on `blur` event, but the last name ({{lastName}})
|
* First name ({{firstName}}) is only updated on `blur` event, but the last name ({{lastName}})
|
||||||
* is updated immediately, because of using `ng:bind-immediate`.
|
* is updated immediately, because of using `ng:model-instant`.
|
||||||
* </doc:source>
|
* </doc:source>
|
||||||
* <doc:scenario>
|
* <doc:scenario>
|
||||||
* it('should update first name on blur', function() {
|
* it('should update first name on blur', function() {
|
||||||
|
|
@ -1034,7 +1034,7 @@ var ngChangeDirective = valueFn({
|
||||||
* </doc:scenario>
|
* </doc:scenario>
|
||||||
* </doc:example>
|
* </doc:example>
|
||||||
*/
|
*/
|
||||||
var ngBindImmediateDirective = ['$browser', function($browser) {
|
var ngModelInstantDirective = ['$browser', function($browser) {
|
||||||
return {
|
return {
|
||||||
require: 'ngModel',
|
require: 'ngModel',
|
||||||
link: function(scope, element, attr, ctrl) {
|
link: function(scope, element, attr, ctrl) {
|
||||||
|
|
|
||||||
|
|
@ -923,10 +923,10 @@ describe('input', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('ng:bind-change', function() {
|
describe('ng:model-instant', function() {
|
||||||
|
|
||||||
it('should bind keydown, change, input events', inject(function($browser) {
|
it('should bind keydown, change, input events', inject(function($browser) {
|
||||||
compileInput('<input type="text" ng:model="value" ng:bind-immediate />');
|
compileInput('<input type="text" ng:model="value" ng:model-instant />');
|
||||||
|
|
||||||
inputElm.val('value1');
|
inputElm.val('value1');
|
||||||
browserTrigger(inputElm, 'keydown');
|
browserTrigger(inputElm, 'keydown');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue