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("my-app", ['dx', 'ngFileSaver']) | |
.controller("app-ctrl", ['$scope', '$http', function ($scope, $http) { | |
$scope.downloadPDF = function downloadPDF() { | |
$http({ | |
url: 'http://localhost:3000/data', | |
method: 'GET', | |
}) | |
.then((res) => { | |
console.log(res.data.lorem); | |
$scope.pdf = 'data:application/octet-stream;base64,' + res.data.lorem; |
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 = angular.module('plunker', []); | |
app.factory('myService', function($http) { | |
return { | |
async: function() { | |
return $http.get('test.json'); //1. this returns promise | |
} | |
}; | |
}); |
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 { Observable } from "rxjs/Observable"; | |
import { Injectable } from "@angular/core"; | |
import { Http, Response } from "@angular/http"; | |
import 'rxjs/add/operator/map'; | |
@Injectable() | |
export class HttpClient { | |
constructor( | |
public http: Http |
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
interface Subject { | |
registerObserver(o: Observer): void; | |
removeObserver(o: Observer): void; | |
notifyObservers(): void; | |
} | |
interface Observer { | |
update(temperature: number): void; | |
} |
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
"scripts": { | |
"clean": "rimraf dist", | |
"build": "tsc", | |
"watch:build": "tsc --watch", | |
"watch:server": "nodemon './dist/index.js' --watch './dist'", | |
"start": "npm-run-all clean build --parallel watch:build watch:server --print-label" | |
}, |
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('myModule', []); | |
angular.module('myModule').controller('ControllerOne', ['$scope', function($scope) { | |
}]); | |
angular.module('myModule').controller('ControllerTwo', ['$scope', function ($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
<button onClick={this.props.greet}>Greet</button> |
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 TimerExample = React.createClass({ | |
getInitialState: function () { | |
return {elapsed: 0} | |
}, | |
componentDidMount: function () { | |
this.timer = setInterval(this.tick, 50); | |
}, |
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
class Child extends React.Component { | |
render () { | |
return (<div>I'm the child</div>); | |
} | |
} | |
class ShowHide extends React.Component { | |
constructor () { | |
super (); | |
this.state = { |