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
Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14 Feb 13 Feb 12 Feb 11 Feb 10 Feb 9 Feb 8 Feb 7 Feb 6 Feb 5 Feb 4 Feb 3 Feb 2 Feb 1 Jan 31 Jan 30 Jan 29 Jan 28 Jan 27 Jan 26 Jan 25 Jan 24 Jan 23 Jan 22 Jan 21 Jan 20 Jan 19 Jan 18 Jan 17 Jan 16 Jan 15 Jan 14 Jan 13 Jan 12 Jan 11 Jan 10
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);
            });
        });
    });
})();