angular数据请求 token验证
angualr的token 验证会经常用在登录,注册等地方
对于token的使用方法按照以下步骤进行使用即可
1.新建一个服务
ng g service services /+服务名
eg:ng g service services/player
会在根目录下出现一个叫service的服务文件夹
文件夹中会存在一个player.service,ts和一个player.service,spec.ts
2. ...
angular配置懒加载路由的思路
前言
本人记性不好,对于别人很容易记住的事情,我愣是记不住,所以还是靠烂笔头来帮我长长记性。
参考文章:https://blog.csdn.net/xif3681/article/details/84584317
正文
NgModule作为Angular模块的核心,下面首先就来讲一讲。
1.@NgModule的作用:
NgModule 最根本的意义是帮助开发者组织业务代 ...
angular实现draggable拖拽
前言:最近项目要实现一个拖拽功能,我在网上开始了各类搜寻,虽然后面因为数据原因舍弃了拖拽的这一需求,但是为了不辜负最近的研究,还是来记录一下。
场景需求:面试预约选时间节点,候选人之间是可以相互交换的,但是局限于面试方向相同的候选人才能相互拖拽(拖拽后即表示两个候选人之间交换面试时间)。本来此种场景 ...
Angular 学习笔记 (动态组件 & Material Overlay & Dialog 分析)
更新 : 2020-6-22
当 ngtemplate 被丢到千里之外, detech change 失效
refer issue : https://github.com/angular/vscode-ng-language-service/issues/824
举个例子,
比如我们把一个 template 传进去 mat dialog 里面,然后让 dialog 里面负责 container.insert template
template 的 “家” 是打开 dialo ...
Angular 学习笔记 (Angular 9 & ivy)
refer :
https://blog.angularindepth.com/all-you-need-to-know-about-ivy-the-new-angular-engine-9cde471f42cf
https://blog.angularindepth.com/asynchronous-modules-and-components-in-angular-ivy-1c1d79d45bd3
https://blog.angularindepth.com/the-future-of-standalone-components-in-the-post-ivy-release ...
Angular Material TreeTable Component 使用教程
一. 安装
npm i ng-material-treetable --save
npm i @angular/material @angular/cdk @angular/animations --save
二、配置
在app.module.ts中导入模块
import { TreetableModule } from 'ng-material-treetable';
@NgModule({
...
imports: [
...
TreetableModule
],
...
})
export clas ...
angular的基本使用
1、在组件中的component.ts文件中可以直接定义属性和它的值,在前端html页面中,通过{{title}}的方式来引用
public title: any = 'username' // any 表示可以为任何类型的值 如果为其他的比如string/boolean则代表只能为这种类型值
定义属性的三种方式 1、public:公有属性,可以在类里面使用,也 ...
使用 Angular RouteReuseStrategy 缓存(路由)组件
使用 Angular RouteReuseStrategy 缓存组件
Cache components with Angular RouteReuseStrategy
RouteReuseStrategy provider 允许我们控制 Angular 路由和组件生命周期的行为。
当我们在组件间切换的时候,Angular都会销毁上一个组件,并且创建一个新的组件。在大多数情况下,我们可能不想让它这样工作,因为每次加载一个 ...
angular + spring boot + mysql
花了两周的时间,我终于做完实训了。
这次用的全是新学的技术,前端框架是angular,组件库是ngzorro的,后端是spring boot,数据库是mysql。这次被逼着学习新东西,总算是凑凑合合把这些技术学会了。
先说前端的angular框架,现在我学会了基本的建component,设置路由和其他一些框架的特效,如果以后要用却忘记 ...
angular之跨域
一、什么是跨域?
跨域是指一个域下的文档或者脚本去请求另一个域下的资源。(广义)
广义的跨域:
1、资源跳转:链接跳转、重定向、表单提交。
2、资源嵌入:<link>、<script>、<img>、<frame>等dom标签;还有background:url()、
&nbs ...
Angular实现类似vuex状态管理功能、全局数据管理与同步更新
自定义实现angular中数据的状态管理,如有不妥请指正
一、先介绍一下rxjs中subject;
Subject 数据的订阅与分发,结合报刊的发布与订阅进行功能的模拟,subject即是observeable对象也是observer对象,subject对于后期没有数据更新时所添加的订阅者是不怎么友好的,因为不跟新数据时订阅者就不在收到返回的数值
import ...
angular常用命令整理
body { font-family: "Merriweather", serif; margin: 0; padding: 0; color: rgba(58, 58, 58, 1); line-height: 1.7; background-color: rgba(248, 248, 248, 1) }
h1, h2, h3 { color: rgba(53, 68, 88, 1); font-weight: 700 }
a { color: rgba(52, 152, 219, 1); text-decoration: none }
a:hover { text-decoration: ...
angular 读写电脑本地文件
angular 读写本地电脑文件
angular将数据写进到电脑文件
在前端写一个按钮,然后点击按钮的时候在本地电脑保存一个text文件。
这时候我们需要用到一个angular的插件,叫做“FileSaver.js”
官方github:https://github.com/eligrey/FileSaver.js
插件安装:
npm install file-saver --save
html:
<button style="backgro ...
angularjs link compile与controller的区别详解,了解angular生命周期
壹 ❀ 引
我在 angularjs 一篇文章看懂自定义指令directive 一文中简单提及了自定义指令中的link链接函数与compile编译函数,并说到两者具有互斥特性,即同时存在link与compile时link不生效。由于上篇博文篇幅问题,实在不好再过多讨论link,compile,那么本文将围绕三个问题展开,一是再识link与compile函数, ...
【2019-10-16】Angular.json文件解析
Angular.json文件解析: 提供了全工作区级的配置和具体项目的默认配置,供Angular Cli中的构建工具和开发工具使用。此配置
所提供的路径都是相对于工作区根目录的
------ 6个option位于文件的顶级,用于配置工作空间 ---------
1、$schema:"./node_modules/@angular/cli/lib/config/schema.json"
// JSON schema是一个允&nb ...
nginx部署angular
官方部署教程
本文将angular官网的示例项目 heroes(英雄指南) 部署到nginx.
使用angular cli编译项目
ng build
执行完成后会生成一个 dist 目录.
服务器配置
首先, 把刚才dist目录下的文件复制到服务器上的某个位置, 一会再nginx的配置文件中要用到;
我把它放到了: /root/Web/Site/angular-heroes/angular-heroes-front
...
Angular--CheckBox
1.Angular,只点击一个checkbox ,却选中/取消所有name相同的CheckBox。
在使用CheckBox控件时,若使用ng-model进行数据绑定时,会造成只点击一个checkbox ,却选中/取消所有name相同的CheckBox。
此时将ng-model数据绑定取消即可
<div class="form-group">
<label class="control-label col-xs-1">合同语种:</label ...
angular 跳转返回上一页
HTML中<script src="lib/angular/angular-1.4.9/angular.js"></script>
<script src="lib/angular/angular-ui-router.min.js"></script>
app中
angular.module('ConsoleUIApp', ['ui.router','ui.bootstrap'])
.config(function ($stateProvider, $urlRouterProvider, $httpProvider) {
...
用electrion打包angular成桌面应用
用electrion官网的不行。
还好,可以直接照搬 https://github.com/maximegris/angular-electron
安装必要的库
npm i --save-dev electron electron-builder electron-reload npm-run-all wait-on
需要从angular-electron 里复制出来:
./下的
main.ts
tsconfig.json
tsconfig.app.json
tsconfig-serve.json
po ...
Angular 调试
我们新建一个项目。执行 ng server 会启动一个网站。
1. 执行 where ng 。看看ng 是什么.
D:\Abp学习\angular\Mytest>where ng
C:%users\QiGongbo\AppData\Roaming\npm\ng
C:%users\QiGongbo\AppData\Roaming\npm\ng.cmd
实际执行到了ng.cmd:
@IF EXIST "%~dp0\node.exe" ( # C:%users\QiGongbo\AppData\Roaming\npm ...