Skip to content

Commit c27aba4

Browse files
committed
refactor(api): remove type augmentation
BREAK: - remove angular.[Object/Array/String/Function] - in templates [].$filter(predicate) and friends need to change to [] | filter:predicate
1 parent dd9151e commit c27aba4

File tree

11 files changed

+35
-596
lines changed

11 files changed

+35
-596
lines changed

docs/src/templates/docs.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
DocsController.$inject = ['$location', '$window', '$cookies'];
2-
function DocsController($location, $window, $cookies) {
1+
DocsController.$inject = ['$location', '$window', '$cookies', '$filter'];
2+
function DocsController($location, $window, $cookies, $filter) {
33
window.$root = this.$root;
44

55
var scope = this,
66
OFFLINE_COOKIE_NAME = 'ng-offline',
77
DOCS_PATH = /^\/(api)|(guide)|(cookbook)|(misc)|(tutorial)/,
8-
INDEX_PATH = /^(\/|\/index[^\.]*.html)$/;
8+
INDEX_PATH = /^(\/|\/index[^\.]*.html)$/,
9+
filter = $filter('filter');
910

1011
scope.$location = $location;
1112
scope.versionNumber = angular.version.full;
@@ -25,7 +26,7 @@ function DocsController($location, $window, $cookies) {
2526
var parts = path.split('/');
2627
scope.sectionId = parts[1];
2728
scope.partialId = parts[2] || 'index';
28-
scope.pages = angular.Array.filter(NG_PAGES, {section: scope.sectionId});
29+
scope.pages = filter(NG_PAGES, {section: scope.sectionId});
2930

3031
var i = scope.pages.length;
3132
while (i--) {

docs/src/templates/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
type: 'text/css'});
2828
addTag('script', {src: 'syntaxhighlighter/syntaxhighlighter-combined.js'}, sync);
2929
if (jQuery) addTag('script', {src: 'jquery.min.js'});
30-
addTag('script', {src: angularPath, 'ng:autobind':''}, sync);
30+
addTag('script', {src: angularPath, 'ng:autobind':'', 'ng:modules':'ngdocs'}, sync);
3131
addTag('script', {src: 'docs-combined.js'}, sync);
3232
addTag('script', {src: 'docs-keywords.js'}, sync);
3333

@@ -103,7 +103,7 @@
103103
tabindex="1" accesskey="s">
104104

105105
<ul id="content-list" ng:class="sectionId" ng:cloak>
106-
<li ng:repeat="page in pages.$filter(search)" ng:class="getClass(page)">
106+
<li ng:repeat="page in pages | filter:search" ng:class="getClass(page)">
107107
<a href="{{getUrl(page)}}" ng:class="selectedPartial(page)"
108108
ng:bind="page.shortName"
109109
tabindex="2"></a>

example/personalLog/personalLog.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ function LogCtrl($cookieStore) {
5454
* @param {object} log The log to remove.
5555
*/
5656
this.rmLog = function(log) {
57-
angular.Array.remove(logs, log);
57+
for ( var i = 0; i < logs.length; i++) {
58+
if (log === logs[i]) {
59+
logs.splice(i, 1);
60+
break;
61+
}
62+
}
63+
5864
$cookieStore.put(LOGS, logs);
5965
};
6066

@@ -73,4 +79,4 @@ LogCtrl.$inject = ['$cookieStore'];
7379

7480
//export
7581
example.personalLog.LogCtrl = LogCtrl;
76-
})();
82+
})();

src/Angular.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,13 @@ function indexOf(array, obj) {
560560
return -1;
561561
}
562562

563+
function arrayRemove(array, value) {
564+
var index = indexOf(array, value);
565+
if (index >=0)
566+
array.splice(index, 1);
567+
return value;
568+
}
569+
563570
function isLeafNode (node) {
564571
if (node) {
565572
switch (node.nodeName) {

0 commit comments

Comments
 (0)