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