Skip to content

Instantly share code, notes, and snippets.

View ahmadlinus's full-sized avatar

Ahmad Ahmadian Moghadam ahmadlinus

  • Neocosmo GmbH
View GitHub Profile
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild('placeholder', {read: ViewContainerRef}) container;
constructor(public navCtrl: NavController, private resolver: ComponentFactoryResolver) {
}
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
// reference to the ng-template UI element, rendered as ViewContainerRef class
@ViewChild('placeholder', {read: ViewContainerRef}) container;
constructor(public navCtrl: NavController, private resolver: ComponentFactoryResolver) {
}
<ion-header>
<ion-navbar>
<ion-title>
Ionic Blank
</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<ng-template class="temp" #placeholder></ng-template>
@Component({
selector: 'sample',
template: '<div class="param">\n' +
' {{parameter}}\n' +
'</div>'
})
export class SampleComponent {
// example parameter
@Input('param') parameter: string;
import { Component } from '@angular/core';
import { IonicPage, NavController, Tabs } from 'ionic-angular';
@IonicPage()
@Compnent({
selector: 'custom-component',
templateUrl: '<ion-tabs #mainTabs>
<ion-tab tabIcon="ios-home-outline">Custom Tab 1</ion-tab>
<ion-tab tabIcon="ios-calendar-outline">Custom Tab 2</ion-tab>
@ahmadlinus
ahmadlinus / animation.ts
Last active April 10, 2018 11:50
jQuery animation in Ionic2+
import * as $ from 'jquery';
import { Component } from '@angular/core';
import { IonicPage, NavController } from 'ionic-angular';
@IonicPage()
@Compnent({
selector: 'page-animation',
templateUrl: 'animation.html'
})
// handling app return to foreground
[[NSNotificationCenter defaultCenter]
addObserver:self selector:@selector(handleReload:)
name:UIApplicationWillEnterForegroundNotification
object:nil];
-(void) handleReload: (NSNotification *) note {
NSLog("foreground again!");
}
-(void) restrictRotation:(BOOL) restriction
{
AppDelegate* appDelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
appDelegate.restrictRotation = restriction;
}
-(NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
if(self.restrictRotation)
return UIInterfaceOrientationMaskPortrait;
else
return UIInterfaceOrientationMaskAll;
}
- (void)didDismissWithButtonIndex:(NSInteger)index alertID:(NSString *)alertID{
if ([alertID isEqualToString:@"default"] && index == 1) {
NSLog(@"hi");
}
if ([alertID isEqualToString:@"default"] && index == 2){
NSLog(@"goodbye");
}
}