This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!function(a){console.log(a)}('Hello'); // Returns function statement Hello and true | |
// VS | |
(function(a){console.log(a)})('World'); // Returns function statement: World and undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider('widget', [function(){ | |
var that = this; | |
this.hi = function(){ | |
return 'Hi'; | |
}; | |
this.$get = [function(){ | |
return { | |
hello : function(){ | |
/* | |
* How can a provider reference it self? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget', []). | |
provider('withPrivate', [function(){ | |
var query = 'First'; | |
this.demo = 'Third'; | |
this.setQuery = function(newQuery){ | |
query = newQuery; | |
}; | |
this.$get = [function(){ | |
return { | |
getQuery: function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('youtubeWidget.directives', []). | |
directive('youtubeWidgetApp', function(){ | |
return { | |
restrict: 'C', | |
templateUrl: 'youtubeWidgetApp.html' | |
} | |
}). | |
run(function($templateCache){ | |
$templateCache.put('youtubeWidgetApp.html', '' + | |
'<div class="mod-youtubeWidget">' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget', []). | |
factory('widgetVersion', function(){ | |
return { | |
version: '0.123' | |
} | |
}); | |
/* | |
* Extend widget, sans []s | |
* */ | |
angular.module('widget'). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget.controllers', []). | |
controller('mainCtrl', ['$scope', function($scope){ | |
$scope.test = 'this is a test'; | |
}]); | |
/* | |
* Testing a controller created with angular.module().controller(); | |
* */ | |
describe('Testing controllers created via module\'s controller', function(){ | |
"use strict"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('widget.providers', []). | |
provider('day', function(){ | |
var day = ''; | |
return { | |
setDay: function(current){ | |
day = current; | |
}, | |
$get: function(){ | |
return { | |
day: day + 'day' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$imported-once-files: () !default; | |
@function import-once($name) { | |
@if index($imported-once-files, $name) { | |
@return false; | |
} | |
$imported-once-files: append($imported-once-files, $name); | |
@return true; | |
} |