This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('app', []) | |
.directive('ourDirective', function() { | |
return { | |
restrict: 'E', | |
transclude: false, | |
replace: true, | |
template: '<div>template</div>', | |
// templateURL: '../path/to/file.html', | |
// or function that returns the way for template | |
scope: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'), | |
concat = require('gulp-concat'), | |
ngAnnotate = require('gulp-ng-annotate'), | |
uglify = require('gulp-uglify'), | |
autoprefixer = require('gulp-autoprefixer'), | |
sass = require('gulp-sass'), | |
minifyCss = require('gulp-minify-css'), | |
del = require('del'), | |
imagemin = require('gulp-imagemin'), | |
sourcemaps = require('gulp-sourcemaps'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ion-navbar *navbar> | |
<ion-title> | |
{{getChosenVideo().title || 'Holograms'}} | |
</ion-title> | |
</ion-navbar> | |
<ion-content class="home"> | |
<ion-card *ngFor="#video of video.getVideos()"> | |
<ion-card-header (click)="chooseVideo(video);"> | |
{{video.title}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Page} from 'ionic-framework/ionic'; | |
import {VideoService} from '../../services/videos'; | |
@Page({ | |
templateUrl: 'build/pages/home/home.html', | |
providers: [VideoService] | |
}) | |
export class HomePage { | |
chosenVideo: any; | |
constructor(private video: VideoService) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from 'angular2/core'; | |
@Injectable() | |
export class VideoService { | |
getVideos() { | |
let videos = [ | |
{ | |
title: 'Canned Lightning', | |
src: 'vids/canned_lightning.mp4' | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {App, Platform} from 'ionic-framework/ionic'; | |
import {HomePage} from './pages/home/home'; | |
@App({ | |
template: '<ion-nav [root]="rootPage"></ion-nav>', | |
config: {} // http://ionicframework.com/docs/v2/api/config/Config/ | |
}) | |
export class MyApp { | |
rootPage:any = HomePage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// forEach method, could be shipped as part of an Object Literal/Module | |
var forEach = function (array, callback, scope) { | |
for (var i = 0; i < array.length; i++) { | |
callback.call(scope, i, array[i]); // passes back stuff we need | |
} | |
}; | |
// Usage: | |
// optionally change the scope as final parameter too, like ECMA5 | |
var myNodeList = document.querySelectorAll('li'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.filter('l10n', function() { | |
// In the return function, we must pass in a single parameter which will be the data we will work on. | |
// We have the ability to support multiple other parameters that can be passed into the filter optionally | |
return function(input, key) { | |
// imagine that we have some variables with parsed JSONs | |
/* var JSONS = { | |
'ru': ruJSON, | |
'ua': uaJSON, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = require('app'), | |
browserWindow = require('browser-window'), | |
mainWindow = null; | |
app.on('window-all-closed', function() { | |
app.quit(); | |
}); | |
app.on('ready', function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// real example | |
$ionicLoading.show(); | |
API.post(url, postObject, headers).then(() => { | |
$state.go(homeStateName); | |
$ionicPopup.alert({ | |
template: 'Some text' | |
}); | |
}).then($ionicLoading.hide).catch($ionicLoading.hide); | |