@@ -12,7 +12,6 @@ import {Platform} from '../../platform/platform';
12
12
*/
13
13
@Injectable ( )
14
14
export class IonicApp {
15
- private _cmps : { [ id : string ] : any } = { } ;
16
15
private _disTime : number = 0 ;
17
16
private _scrollTime : number = 0 ;
18
17
private _title : string = '' ;
@@ -145,59 +144,20 @@ export class IonicApp {
145
144
146
145
/**
147
146
* @private
148
- * Register a known component with a key, for easy lookups later.
149
- * @param {string } id The id to use to register the component
150
- * @param {object } component The component to register
151
- */
152
- register ( id : string , component : any ) {
153
- this . _cmps [ id ] = component ;
154
- }
155
-
156
- /**
157
- * @private
158
- * Unregister a known component with a key.
159
- * @param {string } id The id to use to unregister
160
- */
161
- unregister ( id : string ) {
162
- delete this . _cmps [ id ] ;
163
- }
164
-
165
- /**
166
- * @private
167
- * Get a registered component with the given type (returns the first)
168
- * @param {object } cls the type to search for
169
- * @return {object } the matching component, or undefined if none was found
170
147
*/
171
148
getRegisteredComponent ( cls : any ) : any {
172
- for ( let key in this . _cmps ) {
173
- const component = this . _cmps [ key ] ;
174
- if ( component instanceof cls ) {
175
- return component ;
176
- }
177
- }
149
+ // deprecated warning: added 2016-04-28, beta7
150
+ console . warn ( 'Using app.getRegisteredComponent() to query components has been deprecated. ' +
151
+ 'Please use Angular\'s ViewChild annotation instead:\n\nhttp://learnangular2.com/viewChild/' ) ;
178
152
}
179
153
180
154
/**
181
- * Get the component for the given key.
155
+ * @private
182
156
*/
183
157
getComponent ( id : string ) : any {
184
- // deprecated warning
185
- if ( / m e n u / i. test ( id ) ) {
186
- console . warn ( 'Using app.getComponent(menuId) to control menus has been deprecated as of alpha55.\n' +
187
- 'Instead inject MenuController, for example:\n\n' +
188
- 'constructor(menu: MenuController) {\n' +
189
- ' this.menu = menu;\n' +
190
- '}\n' +
191
- 'toggleMenu() {\n' +
192
- ' this.menu.toggle();\n' +
193
- '}\n' +
194
- 'openRightMenu() {\n' +
195
- ' this.menu.open("right");\n' +
196
- '}'
197
- ) ;
198
- }
199
-
200
- return this . _cmps [ id ] ;
158
+ // deprecated warning: added 2016-04-28, beta7
159
+ console . warn ( 'Using app.getComponent() to query components has been deprecated. ' +
160
+ 'Please use Angular\'s ViewChild annotation instead:\n\nhttp://learnangular2.com/viewChild/' ) ;
201
161
}
202
162
203
163
/**
0 commit comments