This file contains hidden or 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
//`first` reads the data from the service | |
Controller first (myService) -> | |
this.firstValue = myService.get().firstValue //using a getter so there's no direct reference | |
myService.onChange(function(newData) { | |
this.firstValue = newData.firstValue | |
}) | |
//`second` sets the data inside the service |
This file contains hidden or 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
app.controller('MainCtrl', function($scope) { | |
$scope.numbers=[1,2,3,4,5,6]; | |
}); | |
app.directive('myRepeat', function($compile){ | |
return { | |
//High priority means it will execute first | |
priority: 5000, | |
//Terminal prevents compilation of any other directive on first pass | |
terminal: true, |
This file contains hidden or 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() { | |
'use strict'; | |
var envconfig = angular.module('app.envConfig', []); | |
envconfig.config(confFunc); | |
envconfig.provider('startup', startupFactory); | |
confFunc.$inject = ['startupProvider']; | |
/* @ngInject */ | |
function confFunc(startupProvider) { |
This file contains hidden or 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
/* jshint -W117, -W030 */ | |
describe('LineItemType', function() { | |
var scope, compileDirective, spy; | |
beforeEach(module('app.lineItem', function($provide) { | |
$provide.service('lineItemType', mockData.lineItemTypeService()); | |
})); | |
beforeEach(inject(function($injector) { | |
var $controller = $injector.get('$controller'); |
This file contains hidden or 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
beforeEach(module('app', function($stateProvider) { | |
$stateProvider.state('default', { | |
url: '/', | |
}); | |
})); |
This file contains hidden or 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
// from http://jsfiddle.net/thomporter/zjFp4/1/ | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" | |
}; | |
}); |
NewerOlder