ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

WD Angular​JS Snippets

by k3v3n ST2/ST3 Missing

AngularJS Snippets for Component, Service, Route, Test and more.

Details

Installs

  • Total 1K
  • Win 881
  • OS X 208
  • Linux 192
Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
OS X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

wd-angular-js-snippets

AngularJS Snippets for Component, Service, Route, Test and more.

Installation

  • Package Control: install the package “WD AngularJS Snippets”
  • Manual: copy files to your Sublime Text User folder

Snippets Cateogries

  • Component
  • Service
  • Route (TBD)

Component

triggercompletion
wdComponent
(function() {
    'use strict';

    function MyComponentController() {

        // private variables
        var private;
        
        // public variables/methods
        this.myFunction = myFunction;

        this.$onInit = function() {
          
        }
        
        function myFunction() {
        
        }
    }

    MyComponentControllerController.$inject = [];

    angular
        .module('warden.components.name')
        .component('wdMyComponent', {
            bindings: {
              // ...  
            },
            controller: MyComponentController,
            controllerAs: 'Ctrl',
            template: '
Hello World
' }); })();
wdComponentTest
(function() {
    'use strict'

    describe('Component: myComponent', function() {

        var component,
            scope,
            $componentController;

        beforeEach(module('app'));

        // SetUp
        beforeEach(inject(function($injector, $rootScope) {
            $componentController = $injector.get('$componentController');

            scope = $rootScope.$new();
            component = $componentController('myComponent',
                {$scope: scope}
            );
        }));

        describe('$onInit', function() {
            it('should do ...', function() {
                expect(component.strings).toBeDefined();
            });
        });
    });

})();

Service

triggercompletion
wdService
(function() {
    'use strict';
    /**
     * @ngdoc service
     * @description
     *
     * Some description to update
     */
    function MYService() {
        var service;

        service = {
            apiFunctionName: apiFunctionName
        };

        function apiFunctionName() {

        }

        return service;
    }

    MyService.\$inject = [];

    angular
        .module('app')
        .service('MyService', MyService);
})();
wdServiceTest
(function() {
    'use strict';

    describe('Service: MyService', function() {

        var MyService;

        beforeEach(module('app'));

        beforeEach(inject(function($injector) {
            MyService = $injector.get('MyService');
        }));

        describe('myFunctionName()', function() {
            it('should do something', function() {
                // Act
                var result = MyService.myFunctionName();
                // Assert
                expect(result).toBe(true);
            });
        });
    });
})();