Commit graph

145 commits

Author SHA1 Message Date
Vojta Jina
15fd735793 refactor($autoScroll): rename to $anchorScroll and allow disabling auto scrolling (links)
Now, that we have autoscroll attribute on ng:include, there is no reason to disable the service completely, so $anchorScrollProvider.disableAutoScrolling() means it won't be scrolling when $location.hash() changes.

And then, it's not $autoScroll at all, it actually scrolls to anchor when it's called, so I renamed
it to $anchorScroll.
2012-01-13 01:07:12 -08:00
Misko Hevery
d648d709f3 refactor(module): strict separation between module-config / app-runtime 2012-01-12 13:40:07 -08:00
Misko Hevery
5143e7bf06 feat(module): new module loader 2012-01-10 22:27:00 -08:00
Igor Minar
614fd3d55a fix(ng:repeat): support repeating over array with null
typeof null == 'object', but it doesn't behave like an object
because its properties can't be dereferenced, so we need
to special-case it.

Closes #702
2012-01-10 22:21:53 -08:00
Igor Minar
7146f70636 fix($httpBackend): fix for jsonp requests 2012-01-09 14:38:32 -08:00
Igor Minar
a13b5ed3bc fix($http): fix and cleanup $http and friends
$http:
- use promises internally
- get rid of XhrFuture that was previously used internally
- get rid of $browser.defer calls for async stuff (serving from cache),
  promises will take care of asynchronicity
- fix transformation bugs (when caching requested + multiple request
  pending + error is returned)
- get rid of native header parsing and instead just lazily parse the
  header string

$httpBackend:
- don't return raw/mock XMLHttpRequest object (we don't use it for
  anything anymore)
- call the callback with response headers string

mock $httpBackend:
- unify response api for expect and when
- call the callback with response headers string
- changed the expect/when failure error message so that EXPECTED and GOT
  values are aligned

Conflicts:

	src/service/http.js
	test/service/compilerSpec.js
	test/service/httpSpec.js
2012-01-09 13:17:48 -08:00
Vojta Jina
5c19766063 feat(ng:include): enable/disable scrolling through autoscroll attribute 2012-01-07 00:18:22 -08:00
Igor Minar
acb4338b70 style(widgetsSpec): ws, unused variables, etc 2012-01-06 12:19:39 -08:00
Igor Minar
cd9a7b9608 fix(ng:repeat): support repeating over array with null
typeof null == 'object', but it doesn't behave like an object
because its properties can't be dereferenced, so we need
to special-case it.

Closes #702
2012-01-06 12:19:39 -08:00
Igor Minar
1d14760c6d fix(ng:include): prevent race conditions by ignoring stale http callbacks
This fix is similar to what I've done in ng:view, if a new template has been requested before the
callback for the previous template returned, ignore it. Otherwise weird race conditions happen
and users might end up getting the content for the previous include rendered instead of the most
recent one.
2011-11-30 14:49:36 -05:00
Igor Minar
dbd880cc0a feat($http): add promise support
quite messy, some tests are missing, contains an experimental jasmine DI support)
2011-11-30 14:49:35 -05:00
Vojta Jina
16363d8000 refactor(ng:view, ng:include): pass cache instance into $http
Instead of doing all the stuff in these widgets (checking cache, etc..) we can rely on $http now...
2011-11-30 14:49:03 -05:00
Vojta Jina
e9f81b6631 fix(mock.$httpBackend): flush() even requests sent during callbacks 2011-11-30 11:17:23 -05:00
Vojta Jina
cd28a2e952 feat(mocks.$httpBackend): add $httpBackend mock
$httpBackend mock allows:
- expecting (asserting) requests
- stubbing (responding without asserting)

Add empty $httpBackend service (currently just wrapper for $browser.xhr)
2011-11-30 11:12:14 -05:00
Vojta Jina
59adadca08 feat($http): new $http service, removing $xhr.*
Features:
- aborting requests
- more flexible callbacks (per status code)
- custom request headers (per request)
- access to response headers
- custom transform functions (both request, response)
- caching
- shortcut methods (get, head, post, put, delete, patch, jsonp)
- exposing pendingCount()
- setting timeout
Breaks Renaming $xhr to $http
Breaks Takes one parameter now - configuration object
Breaks $xhr.cache removed - use configuration cache: true instead
Breaks $xhr.error, $xhr.bulk removed
Breaks Callback functions get parameters: response, status, headers
Closes #38
Closes #80
Closes #180
Closes #299
Closes #342
Closes #395
Closes #413
Closes #414
Closes #507
2011-11-30 11:12:14 -05:00
Misko Hevery
e88dfb734a refactor(injector): $injector is no longer a function.
- $injector('abc') -> $injector.get('abc');
- $injector(fn) -> $injector.invoke(null, fn);
2011-11-14 20:31:19 -08:00
Vojta Jina
acbd7cdf32 style(docs): make jslint happy - fix some warnings 2011-11-14 20:31:19 -08:00
Misko Hevery
16597e8b52 refactor($service): removed almost all references to scope.$service
- still need to remove from factory
2011-11-14 16:39:33 -08:00
Misko Hevery
bd04316a89 refactor(services): migrate angular.service -> module 2011-11-14 16:39:33 -08:00
Misko Hevery
ed36b9da3b refactor(injector): switch to injector 2.0 introduce modules 2011-11-14 16:39:32 -08:00
Misko Hevery
c925f8a657 new(injector): new injector v2.0
- not connected to keep the CL small
2011-11-14 16:39:32 -08:00
Misko Hevery
d12df0d360 refactor(compiler) turn compiler into a service
BREAK
- remove angular.compile() since the compile method is now a service and needs to be injected
2011-11-14 16:39:32 -08:00
Misko Hevery
48697a2b86 refactor(injector): turn scope into a service
- turn scope into a $rootScope service.
- injector is now a starting point for creating angular application.
- added inject() method which wraps jasmine its/beforeEach/afterEach,
  and which allows configuration and injection of services.
- refactor tests to use inject() where possible

BREAK:
- removed angular.scope() method
2011-11-14 16:39:31 -08:00
Igor Minar
615841a5d3 style(widgets): fix typo in a spec comment 2011-10-31 07:19:33 -07:00
Igor Minar
3945f884c5 fix(ng:repeat) with array ignore properties not representing array elements
Along the way I also changed the repeater impl to use for loop instead
of for in loop.

Iteration over objects is handled by creating an array of keys, which is
sorted and this array then determines the order of iteration over an
element. This makes repeating over objects deterministic and
cross-browser compatible.
2011-10-26 12:54:00 -07:00
Igor Minar
d5ccabce60 fix(ng:view): ignore stale xhr callbacks
A lot of badness happens when we don't ignore stale xhrs. These
raceconditions are only apparent when user clicks through the app very
quckly without waiting for routes to fully load.

Closes #619
2011-10-26 12:15:07 -07:00
Igor Minar
bb948176aa test(ng:view): spec cleanup
- remove optional controller definition from specs
- remove extranious digest calls
2011-10-26 12:02:30 -07:00
Igor Minar
833eb3c844 fix(ng:repeat): repeater should ignore $ and $$ properties 2011-10-18 17:27:43 -07:00
Misko Hevery
fd822bdaf9 chore(formating): clean code to be function() { 2011-10-11 11:01:46 -07:00
Misko Hevery
4f78fd692c feat(forms): new and improved forms 2011-10-11 11:01:45 -07:00
Misko Hevery
75f11f1fc4 feat(ng:repeat) collection items and DOM elements affinity / stability 2011-10-11 10:53:04 -07:00
Igor Minar
0e5a24c584 fix(specs): jQuery now returns attr name instead of true/false for special attrs
for special attrs like 'checked' or 'multiple', jquery now returns the name or undedefined.

e.g. foo.attr('checked') => 'checked' || undefined

The solution is a combination of updating our tests as well as switching
over to prop() instead which properly returns true/false
2011-09-16 02:44:32 +02:00
Vojta Jina
22cb600280 fix($route): update $route to reflect $location changes
* update $route to reflect new $location
* add some more unit tests to $route
* fix some other failing unit tests
* redirect overrides the url now

Breaks $route custom redirect fn has only 3 params now
2011-09-08 23:00:59 +02:00
Vojta Jina
988ed451b5 feat($browser): jQuery style url method, onUrlChange event
This is just basic implementation of $browser.url, $browser.onUrlChange methods:

$browser.url() - returns current location.href

$browser.url('/new') - set url to /new
If supported, history.pushState is used, location.href property otherwise.

$browser.url('/new', true) - replace current url with /new
If supported, history.replaceState is used, location.replace otherwise.

$browser.onUrlChange is only fired when url is changed from the browser:
- user types into address bar
- user clicks on back/forward button
- user clicks on link

It's not fired when url is changed using $browser.url()

Breaks Removed $browser.setUrl(), $browser.getUrl(), use $browser.url()
Breaks Removed $browser.onHashChange(), use $browser.onUrlChange()
2011-09-08 20:36:33 +02:00
Igor Minar
06534413d3 fix(ng:options): ng:change should be called after the new val is set
Closes #547
2011-09-07 23:37:37 -07:00
Di Peng
e068addadb feat(widget): add ng:pluralize as an Angular widget 2011-08-30 02:11:09 -07:00
Igor Minar
2bbef363e4 style(*): remove extra semicolons 2011-08-15 00:21:02 -07:00
Misko Hevery
42062dab34 refactor(scope): remove $flush/$observe ng:eval/ng:eval-order 2011-08-12 15:47:47 -07:00
Di Peng
142cffcf64 refactor(widgets): remove input[button, submit, reset, image] and button windgets
These widgets are useless and only trigger extra $updateViews.

The only reason we had them was to support ng:change on these widgets,
but since there are no bindings present in these cases it doesn't make
sense to support ng:change here. It's likely just a leftover from
getangular.com

Breaking change: ng:change for input[button], input[submit], input[reset], input[image]
and button widgets is not supported any more
2011-08-06 01:54:05 -07:00
Misko Hevery
8f0dcbab80 feat(scope): new and improved scope implementation
- Speed improvements (about 4x on flush phase)
- Memory improvements (uses no function closures)
- Break $eval into $apply, $dispatch, $flush
- Introduced $watch and $observe

Breaks angular.equals() use === instead of ==
Breaks angular.scope() does not take parent as first argument
Breaks scope.$watch() takes scope as first argument
Breaks scope.$set(), scope.$get are removed
Breaks scope.$config is removed
Breaks $route.onChange callback has not "this" bounded
2011-08-02 01:00:03 +02:00
Igor Minar
17251372b1 style(ng:options): fix style and some docs 2011-07-26 10:11:40 -07:00
Misko Hevery
f768954f38 fix(ng:options): add support for option groups
Closes# 450
2011-07-26 10:11:06 -07:00
Misko Hevery
3237f8b995 fix(directive): ng:options to support ng:change
Closes #463
2011-07-26 09:41:44 -07:00
Misko Hevery
7802c90e13 fix(directive): ng:options to support iterating over objects
Closes #448
2011-07-26 09:41:43 -07:00
Misko Hevery
c348f2cad6 fix(directive): ng:options incorrectly re-grew options on datasource change
Closes #464
2011-07-26 09:41:42 -07:00
Misko Hevery
f3456dc282 fix(directive): ng:options now support binding to expression
Closes #449
2011-07-26 09:41:41 -07:00
Igor Minar
fe5240732d feat(strict mode): adding strict mode flag to all js files
the flag must be in all src and test files so that we get the benefit of
running in the strict mode even in jstd

the following script was used to modify all files:

for file in `find src test -name "*.js"`; do
  echo -e "'use strict';\n" > temp.txt
  cat $file >> temp.txt
  mv temp.txt $file
done
2011-07-18 12:12:55 -07:00
Igor Minar
bb39d34279 test(ng:repeat): add tests for $position for small arrays/objects 2011-07-12 22:49:12 -07:00
Misko Hevery
9ec45ad5c4 fix🆖repeater - fix $position when collection size changes 2011-06-23 08:12:01 -07:00
Misko Hevery
91a34a7027 remove ng:format=index 2011-06-08 15:21:33 -07:00