WIP
This is based on 0 to LSP : Neovim RC From Scratch by ThePrimeagen. Go check it out, big like and subscribe!
This is a learning by doing hands-on writeup. I suggest doing a writeup on your own if you have the time for it.
| class MoviesService { | |
| static $inject = ['$http', 'auth']; | |
| movies = Promise.resolve([]); | |
| constructor( | |
| private $http: IHttpService, | |
| private auth: AuthService, | |
| ) {} | |
| class MoviesList { | |
| static $inject = ['movies']; | |
| constructor( | |
| movies: MoviesService | |
| ) | |
| } | |
| const MoviesListComponent = { | |
| template: ` |
| @Component({ | |
| ... | |
| providers: [{ provide: AuthService }] | |
| }) | |
| export class EastAndorMovieList |
| moviesApp.directive('printout', ['$sce', function printout($sce) { | |
| return { | |
| restrict: 'A', | |
| require: { | |
| ngModel: '' | |
| }, | |
| link: (scope, element, attrs, requireCtrls) { | |
| requireCtrls.ngModel.$render = function() { | |
| element.html($sce.getTrustedHtml(requireCtrls.ngModel.$viewValue || '')); | |
| }; |
| angular.component('printout', { | |
| template: `<div>{{ $ctrl.model | json:2 }}</div>, | |
| require: { | |
| ngModel: '', | |
| }, | |
| controller: ['$sce', '$element', function controller($sce, $element) { | |
| this.$onInit = () { | |
| this.ngModel.$render = function() { | |
| $element.html($sce.getTrustedHtml(this.ngModel.$viewValue || '')); | |
| }; |
| class AuthService { | |
| static $inject = ['$http']; | |
| private token: string; | |
| constructor($http: IHttpService) {} | |
| getToken() { | |
| if (_.isNil(this.token)) { | |
| this.token = $http.get('my-site.example.com/auth'); |
| class MoviesList { | |
| } | |
| const MoviesListComponent = { | |
| template: ` | |
| <h1>Movies</h1> | |
| <ul> | |
| <li ng-repeat="movie in ($ctrl.movies.movies | promiseAsync) track by movie.id"> | |
| {{ movie.name }} - {{ movie.year }} - {{ movie.rating }} | |
| </li> |
| class AuthService { | |
| static $inject = ['$http']; | |
| private token: string; | |
| constructor($http: IHttpService) {} | |
| getToken() { | |
| if (_.isNil(this.token)) { | |
| this.token = $http.get('my-site.example.com/auth'); |
| const clamp = (min: number, max: number, val: number) => | |
| Math.max(min, Math.min(val, max)); |
WIP
This is based on 0 to LSP : Neovim RC From Scratch by ThePrimeagen. Go check it out, big like and subscribe!
This is a learning by doing hands-on writeup. I suggest doing a writeup on your own if you have the time for it.