1.7.3 • Published 8 years ago

ng-console v1.7.3

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

ngConsole

Small directive for angular, to implement a console that's able to execute commands. You can see a demo here.

With this directive, developers can avoid to design and create a user interface for small tasks like cleaning server cache, restart some backend tasks and so on. Just create the logic, and ngConsole will allow you to execute all these actions from the same place.

Installation

To install ngConsole on your project, follow these steps: 1) Make a npm install ng-console. 2) Copy the file node_modules/ng-console/build/ngConsole.js to your project's folder. 3) Declare ngConsole as a dependency for your module angular.module('myApp' 'ngConsole') 4) Save it. You are done!

Use

Now, you just have to write <ng-console></ng-console> on your code, and that's it, you already have a console installed on your Angular website.

You can use different attributes to customize it:

  • open: Open by default (boolean)
  • fixed: Embeded in your HTML, or fixed and hidden (boolean)
    • If it's fixed, you should press º to open it.
  • fullsize: When fixed, filling the entire screen (boolean)
  • custom-height: Set a custom height, this will be ignored if fullsize is true (number).
  • custom-prefix: The prefix displayed (string)
  • custom-commands: An array with commands that you wanna add to the console. (boolean)

Custom commands

Custom commands must have particular properties to make them work. Each command must have:

  • name: The keyword used to execute the command (string)
  • description: A short description to show with help command (string)
  • params: A list of parameters that can be used with this command (Object: {name: "string", description: "string"})
  • action: The function that's gonna be executed (function(printLn, params){ whatever(); }).

If user wants to use parameters, he/she can use any of these combinations:

  • say --text Hello world
  • say --text "Hello world"
  • say --text=Hello world
  • say --text="Hello world"

In our live example, our custom command say accepts params, so if you execute say --text Something, it's going to prompt you "something". And we are able to get it by doing this: function(printLn, params){   if(params && params.text){     printLn(params.text);   } }

Custom theme

If you want to customize ngConsole's default colors, you can specify a customTheme on your options object.

  • If you want to use a stock theme, just write its name, like this: $scope.options.customTheme = "light"
  • If you want to create a new theme, that's going to be available on your console, write this:

$scope.options.customTheme = {   name: "my theme name",     data:{       bg: "any-css-color",       color: "any-css-color",       boldColor: "any-css-color",       fontfamily: number,       fontsize: "string-font-name"     },     labels:{       bg: "The color name that's going to be displayed",       color: "The color name that's going to be displayed",       boldColor: "The color name that's going to be displayed"     }   } }

1.7.3

8 years ago

1.7.2

8 years ago

1.7.1

8 years ago

1.7.0

8 years ago

1.6.6

8 years ago

1.6.5

8 years ago

1.6.3

8 years ago

1.6.2

8 years ago

1.6.1

8 years ago

1.6.0

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.7

8 years ago

1.4.6

8 years ago

1.4.5

8 years ago

1.4.4

8 years ago

1.4.2

8 years ago

1.4.0

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.5

8 years ago

1.2.2

8 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago