Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

theborakompanioni/angular-chessboard

Repository files navigation

Build Status Dependency Status devDependency Status MIT License

angular-chessboard

Chess Board Directive for AngularJS based on chessboard.js

Examples

Download

Bower

Install with bower

bower install theborakompanioni/angular-chessboard --save

Github

Download from Github

Add the following tags to your project

<link rel="stylesheet" href="/chessboard.js/css/chessboard.css"/>
<script src="/chessboard.js/js/chessboard.js"></script>
<script src="/angular-chessboard/dist/angular-chessboard.min.js"></script>

Usage

Configuration

You can configure the default behaviour of all settings. See chessboard.js Documentation for all values an their purpose.

angular.module('myModule', ['nywton.chessboard']);
angular.config(['nywtonChessboardConfigProvider', function nywtonChessConfigConfig(chessboardProvider) {
  chessboardProvider.draggable(true)
    .position('start')
    .pieceTheme('/chessboard.js/img/chesspieces/wikipedia/{piece}.png');
}])

Directive

The default settings will create a board with draggable pieces in starting position:

<nywton-chessboard></nywton-chessboard>

Create an empty board:

<nywton-chessboard board="boardA" data-position="'empty'"></nywton-chessboard>

Create a board with non-draggable pieces in starting position:

<nywton-chessboard board="boardB" data-draggable="false"></nywton-chessboard>

An auto resizeable board:

<nywton-chessboard board="boardC" 
  data-nywton-chessboard-autoresize
></nywton-chessboard>

A resizeable board initialized with "Ruy Lopez" (or Spanish Opening):

<nywton-chessboard board="boardD" 
  data-nywton-chessboard-autoresize
  data-nywton-position-ruy-lopez
></nywton-chessboard>

Contribute

Clone Repository

git clone https://github.com/theborakompanioni/angular-chessboard.git

Install dependencies

npm install && bower install

Build project

grunt

Run tests

grunt test

License

The project is licensed under the MIT license. See LICENSE for details.

About

Chess Board Directive for AngularJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published