原创 AngularJS8 - 組件
ng g --help (命令幫助) ng g component components/home (創建組件命令) 創建的組件包括: home.component.css home.component.h
原创 CSS佈局 - 水平垂直居中
1 table-cell <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="
原创 AngularJS8 - 項目結構
文件 說明 e2e end to end test node_modules 依賴 src 項目文件 .editorconfig Editor configuration, see https://edi
原创 CSS佈局 - 垂直居中
1 line-height vertical-align <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="vie
原创 AngularJS8 - 綁定數據和屬性
綁定數據:public protected private,不寫則默認爲public import { Component, OnInit } from '@angular/core'; @Component({ sel
原创 AngularJS - 使用的模塊
"angular-resource": "~1.5.0", 我們並不是直接通過$resource服務本身同服務器通信,$resource是一個創建資源對象的工廠,用來創建同服務端交互的對象。return $resource('ap
原创 Express - express-generator
安裝express-generator cnpm install express-generator -g 生成一個express項目learn-express express -e learn-express 安裝依賴並啓動
原创 部署 - PM2 - 啓動express項目
使用pm2來啓動express項目。 先生成一個express項目,並通過npm start啓動。 express -e learn-express cd learn-express npm install learn-expre
原创 NodeJS - nodemon
使用nodemon來避免每次修改文件時都要重新手動啓動。 安裝 cnpm install nodemon -g 使用 nodemon server 替換 node server 來啓動項目。 此時代碼有任何變化,nodemo
原创 NodeJS - cnpm
安裝: npm install -g cnpm --registry=https://registry.npm.taobao.org 檢測安裝是否成功: cnpm version 直接使用cnpm進行包安裝即可。
原创 NodeJS - mocha
// mocha是nodejs下的自動化測試框架,可以大大簡化異步測試的複雜度,並且提供相關的報告。安裝:npm install --global mocha var request = require('supertest')
原创 NodeJS - oauth2 驗證中的三種策略
1.LocalStrategy 本地策略 This strategy is used to authenticate users based on a username and password. Anytime a request
原创 JS - 利用slice複製新數組
var arr1 = [1, 2, 3]; var arr2 = arr1.slice(0); arr2.push(4) console.info(arr2); //[1, 2, 3, 4] console.info(arr1); /
原创 JS - 日期 - 使用時間戳比較2個日期的大小
let date1 = new Date('2019-05-08'); let date2 = new Date('2019-05-08'); console.log(date1.getTime() == date2.getTime(
原创 JS - 日期 - 獲取某月的最大天數
函數 new Date(y, m, 0).getDate(); 天 的值是0,js會返回上一個月的最後一天,即最大天數。 示例 new Date(2019, 6, 0).getDate(); // 30 new Date(201