Skip to main content

Posts

Showing posts with the label javascript

Nginx rewrite rules for hosting angular(any) static app on subroute

Hi everyone, I decided to reorganise my personal blog and use it mostly as "Notes" Today, I want to host two websites served by golang application. The simplest solution is to create system service which points to go executable app on the particular port. In a nutshell, there are two separate services which use 9990 and 9991 ports. Next step I added this simple rule to the Nginx location /admin { rewrite /admin/(.*) /$1 break; proxy_pass http://localhost:9991; proxy_redirect off; proxy_set_header Host $host; } location / { proxy_pass http://localhost:9990; } So this simple configuration just rewrites URL properly to the admin service and I do not need to add extra `admin` route prefix. The latest step is set-up base href for the static `index.html` file. We can easily do it with build option `ng build --base-href /admin/` Thank everyone for reading.

Create table with dynamic rows and configurable row buttons with AngularJS

Hi all, Today I want to write a short article how to create a table with dynamic configuration for rows. For example, I need to render simple table by data provided from a server and append to each row some extendable buttons, checkboxes etc. for making action on a row. For example, I will use this data:   app.controller('MainCtrl', ['$scope', function($scope) { var vm = this; var tableData = [{ firstName: 'Viktor', lastName: 'Dzundza', age: 25 }, { firstName: 'Jony', lastName: 'Boyko', age: 24 }, { firstName: 'John', lastName: 'Doe', age: 45 }, { firstName: 'Alisa', lastName: 'Doe', age: 2 } ]; var tableMeta = { columns: [{ name: 'firstName', title: 'First Name' }, { name: 'lastName', title: 'Last Name' }, { name: 'age',...