Posts

Showing posts from December, 2017

Using Material design with Angular 5

Getting your material installed using the following command, this basically install most of the stuff you need.  :-

npm install --save @angular/material @angular/cdk
Next make sure you're using the pre-built theme or you can define your own.

@import'~@angular/material/prebuilt-themes/deeppurple-amber.css';
Next, load the required module in your app module. For example, if you're using


import {MatButtonModule, MatInputModule, MatCheckboxModule} from'@angular/material';
In this line above, we're going to be using material button, input (textarea, etc) and checkbox.

Finally we will be applying this to our component, by adding "mat-button" to my button object.

<buttonmat-button (click)="save()"> Save</button>

Further application can be found here with the documentation.

https://material.angular.io/components/radio/overview

Typescript : How do you clear an array?

Answer :  this.cities.length = 0, given this.cities is your array.


Typescript array and getting error property 'push' of undefined

If you ever bump into this error, well it just you forgot something really basic and the solution is pretty straight forward too.

In case, you're wondering why, it is because you didn't initialize it well 'enough' :)




Module cannot find HttpModule

When trying to load ngrx effects into my application, i encountered the following error message -


ERROR in src/app/app.module.ts(29,20): error TS2304: Cannot find name 'HttpModule'.


Having a closer look, i need to add the following code


All i need to do is to include HttpModule into my app.module.ts as shown in code below :-






Working with Angular5 with ngrx - Getting an exception import 'xxxx.ts' is not a module

While working with Angular5/ngrx i got this error "xxxx.ts" is NOT a module.  Didn't really know what the heck is going on. Finally restarting VSCode and ng serve --open i was able to get rid of this error.

If anyone still trying out using this example here : https://github.com/ngrx/store, well, it works. You can use this example for ngrx 4 and Angular. It's all good.



Modularizing route into different file using flask blueprint

Flask provides a function call blueprint to help you place / manage your route file into different files. This makes your code more manageable and  modular.

Controller.py in different folder / directory.



App.py








Flask working with post query string, form data and json post

Flask provides the following method to work with query string, form data and json.

For query string use

request.args.get('textinput')


For Form use

request.form.get('textinput')

For Post json

jsonData = request.json