Merge branch 'master' into list-border-refactor

Conflicts:
	ionic/util/dom.ts
This commit is contained in:
Brandy Carney
2015-11-05 19:16:24 -05:00
10 changed files with 72 additions and 48 deletions

View File

@@ -206,6 +206,7 @@ class AnotherPage {
@App({
pages: [FirstPage, FullPage, PrimaryHeaderPage, AnotherPage],
template: `<ion-nav [root]="root"></ion-nav>`
})
class E2EApp {

View File

@@ -20,9 +20,12 @@ import {initTapClick} from '../components/tap-click/tap-click';
import * as dom from '../util/dom';
export function ionicProviders(config) {
export function ionicProviders(args) {
let app = new IonicApp();
let platform = new Platform();
let navRegistry = new NavRegistry(args.pages);
var config = args.config;
if (!(config instanceof Config)) {
config = new Config(config);
@@ -50,6 +53,7 @@ export function ionicProviders(config) {
provide(Platform, {useValue: platform}),
provide(FeatureDetect, {useValue: featureDetect}),
provide(Events, {useValue: events}),
provide(NavRegistry, {useValue: navRegistry}),
Form,
Keyboard,
OverlayController,
@@ -57,7 +61,6 @@ export function ionicProviders(config) {
Modal,
Popup,
Translate,
NavRegistry,
ROUTER_PROVIDERS,
provide(LocationStrategy, {useClass: HashLocationStrategy}),
HTTP_PROVIDERS,

View File

@@ -135,7 +135,7 @@ export function App(args={}) {
Reflect.defineMetadata('annotations', annotations, cls);
console.time('bootstrap');
bootstrap(cls, ionicProviders(args.config)).then(() => {
bootstrap(cls, ionicProviders(args)).then(() => {
console.timeEnd('bootstrap');
});

View File

@@ -244,13 +244,20 @@ export function getDimensions(ion, ele) {
let dimensions = dimensionCache[ion._dimId];
if (!dimensions) {
ele = ele || ion.getNativeElement();
dimensions = dimensionCache[ion._dimId] = {
width: ele.offsetWidth,
height: ele.offsetHeight,
left: ele.offsetLeft,
top: ele.offsetTop
};
let ele = ion.getNativeElement();
// make sure we got good values before caching
if (ele.offsetWidth && ele.offsetHeight) {
dimensions = dimensionCache[ion._dimId] = {
width: ele.offsetWidth,
height: ele.offsetHeight,
left: ele.offsetLeft,
top: ele.offsetTop
};
} else {
// do not cache bad values
return { width: 0, height: 0, left: 0, top: 0 };
}
}
return dimensions;
@@ -258,10 +265,16 @@ export function getDimensions(ion, ele) {
export function windowDimensions() {
if (!dimensionCache.win) {
dimensionCache.win = {
width: window.innerWidth,
height: window.innerHeight
};
// make sure we got good values before caching
if (window.innerWidth && window.innerHeight) {
dimensionCache.win = {
width: window.innerWidth,
height: window.innerHeight
};
} else {
// do not cache bad values
return { width: 0, height: 0 };
}
}
return dimensionCache.win;
}