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