\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{amihapsari} \pdfinfo{ /Title (table-hitung-angular-6.pdf) /Creator (Cheatography) /Author (amihapsari) /Subject (Table Hitung Angular 6 Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A34929} \definecolor{LightBackground}{HTML}{F9F3F1} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Table Hitung Angular 6 Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{amihapsari} via \textcolor{DarkBackground}{\uline{cheatography.com/82859/cs/19675/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}amihapsari \\ \uline{cheatography.com/amihapsari} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 22nd May, 2019.\\ Updated 22nd May, 2019.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{x{1.47619 cm} x{1.95681 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Angular CLI}} \tn % Row 0 \SetRowColor{LightBackground} Generating classes & ng g cl {[}class's name{]} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Serving commands & ng serve \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} & ng serve -o \tn % Row Count 4 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{\seqsplit{my-app/src/app/app.component.css}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{table\{ \newline margin-left: auto; \newline margin-right: auto; \newline \} \newline .tabel2 \{ \newline border-collapse: collapse; \newline \} \newline \newline .tabel2, tr, th, td \{ \newline border: 1px solid black; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Button / Tombol}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textless{}button type="submit" class="btn btn-primary" (click)="onNew()"\textgreater{}New\textless{}/button\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.3732 cm} x{2.0598 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Metode 1}} \tn % Row 0 \SetRowColor{LightBackground} Tampilkan Data & \{\{ title \}\} \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Tombol untuk Buka Form Baru & \textless{}button type="submit" class="btn btn-primary" (click)="onNew()"\textgreater{}New\textless{}/button\textgreater{} \tn % Row Count 5 (+ 4) % Row 2 \SetRowColor{LightBackground} If & \textless{}div *ngIf="showNew"\textgreater{}\textless{}/div\textgreater{} \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} Form Submit & \textless{}form (ngSubmit) = "onSave()"\textgreater{}\textless{}/form\textgreater{} \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} Binding & \textless{}td\textgreater{}\textless{}input type="text" class="form-control" {[}(ngModel){]}="stockReg.SKU" name="SKU"\textgreater{}\textless{}/td\textgreater{} \tn % Row Count 13 (+ 4) % Row 5 \SetRowColor{white} Tombol Submit & \textless{}button type="submit"\textgreater{}\{\{submitType\}\}\textless{}/button\textgreater{} \tn % Row Count 15 (+ 2) % Row 6 \SetRowColor{LightBackground} Retrieve Data & \textless{}td\textgreater{}\{\{ stc.kuantitas \}\}\textless{}/td\textgreater{} \tn % Row Count 17 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{\seqsplit{my-app/src/app/app.component.html}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{\textless{}!-{}-The content below is only a placeholder and can be replaced.-{}-\textgreater{} \newline \textless{}div style="text-align:center"\textgreater{} \newline \textless{}h1\textgreater{} \newline CRUD \{\{ title \}\} \newline \textless{}/h1\textgreater{} \newline \textless{}h2\textgreater{}Insert Data\textless{}/h2\textgreater{} \newline \textless{}button type="submit" class="btn btn-primary" (click)="onNew()"\textgreater{}New\textless{}/button\textgreater{} \newline \textless{}div {\emph{ngIf="showNew"\textgreater{} \newline \textless{}form (ngSubmit) = "onSave()"\textgreater{} \newline \textless{}table style="border: 1px solid white"\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td\textgreater{}SKU\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}input type="text" class="form-control" {[}(ngModel){]}="stockReg.SKU" name="SKU"\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td\textgreater{}Nama\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}input type="text" class="form-control" {[}(ngModel){]}="stockReg.nama" name="nama"\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td\textgreater{}Kuantitas\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}input type="number" class="form-control" {[}(ngModel){]}="stockReg.kuantitas" name="kuantitas"\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td\textgreater{}hargaBeli\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}input type="number" class="form-control" {[}(ngModel){]}="stockReg.hargaBeli" name="hargaBeli"\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}td\textgreater{}hargaJual\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}input type="number" class="form-control" {[}(ngModel){]}="stockReg.hargaJual" name="hargaJual"\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \newline \newline \textless{}/table\textgreater{} \newline \newline \textless{}button type="submit"\textgreater{}\{\{submitType\}\}\textless{}/button\textgreater{} \newline \textless{}button type="submit" (click)="onCancel()"\textgreater{}Cancel\textless{}/button\textgreater{} \newline \textless{}/form\textgreater{} \newline \textless{}/div\textgreater{} \newline \newline \newline \textless{}h2\textgreater{}Result\textless{}/h2\textgreater{} \newline \textless{}table class='tabel2'\textgreater{} \newline \textless{}thead\textgreater{} \newline \textless{}tr\textgreater{} \newline \textless{}th\textgreater{}No.\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}SKU\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Nama\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Kuantitas \textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Harga beli\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Harga jual\textless{}/th\textgreater{} \newline \textless{}th\textgreater{}Profit per item\textless{}/th\textgreater{} \newline \textless{}th colspan="2"\textgreater{}Action\textless{}/th\textgreater{} \newline \newline \textless{}/tr\textgreater{} \newline \textless{}/thead\textgreater{} \newline \textless{}tbody\textgreater{} \newline \textless{}tr }}ngFor="let stc of listStock; let i = index"\textgreater{} \newline \textless{}th scope="row"\textgreater{}\{\{ i+1 \}\}\textless{}/th\textgreater{} \newline \textless{}td scope="row"\textgreater{}\{\{ stc.SKU \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\{\{ stc.nama \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\{\{ stc.kuantitas \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\{\{ stc.hargaBeli \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\{\{ stc.hargaJual \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\{\{ stc.getProfit() \}\}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}button type="button" (click)="onEdit(i)"\textgreater{}Edit\textless{}/button\textgreater{}\textless{}/td\textgreater{} \newline \textless{}td\textgreater{}\textless{}button type="button" (click)="onDelete(i)"\textgreater{}Delete\textless{}/button\textgreater{}\textless{}/td\textgreater{} \newline \textless{}/tr\textgreater{} \newline \textless{}/tbody\textgreater{} \newline \newline \textless{}/table\textgreater{}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Kelas}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{class StockBarang\{ \newline constructor( \newline public SKU: string = '', \newline public kuantitas: number = null, \newline )\{\} \newline getProfit()\{ \newline this.profit = \seqsplit{this.hargaJual-this.hargaBeli;} \newline return this.profit; \newline \} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Inisiasi}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{export class AppComponent implements OnInit\{ \newline listStock: StockBarang{[}{]} = {[}{]}; \newline stockReg: StockBarang; \newline showNew: Boolean = false; \newline selectedRow: number; \newline submitType: string = 'Save'; \newline constructor()\{ \newline this.listStock.push(new StockBarang('AIR001', 'Aqua', 10, 3000, 6000, null)); \newline ngOnInit()\{\} \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{create}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onNew()\{ \newline this.stockReg = new StockBarang(); \newline this.submitType = 'Save'; \newline this.showNew = true; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{save}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onSave()\{ \newline if(this.submitType === 'Save')\{ \newline \seqsplit{this.listStock.push(this.stockReg);} \newline \} \newline else\{ \newline //Update \newline this.listStock{[}this.selectedRow{]}.SKU = this.stockReg.SKU; \newline \} \newline //Hide \newline this.showNew = false; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{edit}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onEdit(index: number)\{ \newline this.submitType = 'Update'; \newline this.selectedRow = index; \newline this.stockReg = new StockBarang(); \newline this.stockReg = Object.assign(\{\}, \newline this.listStock{[}this.selectedRow{]}); \newline this.showNew = true; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{delete}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onDelete(index: number)\{ \newline \seqsplit{this.listStock.splice(index}, 1); \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{Cancel}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{onCancel()\{ \newline this.showNew = false; \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{\seqsplit{my-app/src/app/app.component.ts}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{import \{ Component, OnInit \} from '@angular/core'; \newline \newline \newline \newline class StockBarang\{ \newline constructor( \newline public SKU: string = '', \newline public nama: string = '', \newline public kuantitas: number = null, \newline public hargaBeli: number = null, \newline public hargaJual: number = null, \newline public profit: number = null, \newline )\{\} \newline getProfit()\{ \newline this.profit = \seqsplit{this.hargaJual-this.hargaBeli;} \newline return this.profit; \newline \} \newline \} \newline \newline @Component(\{ \newline selector: 'app-root', \newline templateUrl: './app.component.html', \newline styleUrls: {[}'./app.component.css'{]} \newline \}) \newline \newline export class AppComponent implements OnInit\{ \newline listStock: StockBarang{[}{]} = {[}{]}; \newline stockReg: StockBarang; \newline showNew: Boolean = false; \newline selectedRow: number; \newline submitType: string = 'Save'; \newline constructor()\{ \newline this.listStock.push(new StockBarang('AIR001', 'Aqua', 10, 3000, 6000, null)); \newline this.listStock.push(new StockBarang('SOF001', 'Coca Cola', 20, 5000, 4500, null)); \newline this.listStock.push(new StockBarang('SNK001', 'Chitato', 15, 4000, 5000, null)); \newline \} \newline ngOnInit()\{\} \newline \newline onNew()\{ \newline this.stockReg = new StockBarang(); \newline this.submitType = 'Save'; \newline this.showNew = true; \newline \} \newline \newline onSave()\{ \newline if(this.submitType === 'Save')\{ \newline \seqsplit{this.listStock.push(this.stockReg);} \newline \} \newline else\{ \newline //Update \newline this.listStock{[}this.selectedRow{]}.SKU = this.stockReg.SKU; \newline this.listStock{[}this.selectedRow{]}.nama = this.stockReg.nama; \newline this.listStock{[}this.selectedRow{]}.kuantitas = this.stockReg.kuantitas; \newline this.listStock{[}this.selectedRow{]}.hargaBeli = this.stockReg.hargaBeli; \newline this.listStock{[}this.selectedRow{]}.hargaJual = this.stockReg.hargaJual; \newline this.listStock{[}this.selectedRow{]}.profit = this.stockReg.profit; \newline \} \newline //Hide \newline this.showNew = false; \newline \} \newline \newline onEdit(index: number)\{ \newline this.submitType = 'Update'; \newline this.selectedRow = index; \newline this.stockReg = new StockBarang(); \newline this.stockReg = Object.assign(\{\}, \newline this.listStock{[}this.selectedRow{]}); \newline this.showNew = true; \newline \} \newline \newline onDelete(index: number)\{ \newline \seqsplit{this.listStock.splice(index}, 1); \newline \} \newline \newline onCancel()\{ \newline this.showNew = false; \newline \} \newline \newline \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{3.833cm}}{\bf\textcolor{white}{\seqsplit{my-app/src/app/app.module.ts}}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{3.833cm}}{import \{ BrowserModule \} from \seqsplit{'@angular/platform-browser';} \newline import \{ NgModule \} from '@angular/core'; \newline import \{ FormsModule \} from '@angular/forms'; \newline \newline import \{ AppComponent \} from './app.component'; \newline \newline @NgModule(\{ \newline declarations: {[} \newline AppComponent \newline {]}, \newline imports: {[} \newline BrowserModule, \newline FormsModule \newline {]}, \newline providers: {[}{]}, \newline bootstrap: {[}AppComponent{]} \newline \}) \newline export class AppModule \{ \}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}