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
| 'use strict'; | |
| beforeEach(function() { | |
| module('lama'); | |
| module('lama.system'); | |
| module('stateMock'); | |
| }); | |
| var $httpBackend,$state; | |
| beforeEach(inject(function( _$httpBackend_, _$state_) { | |
| $httpBackend = _$httpBackend_; | |
| $httpBackend.when('GET', '/api/v1/user/menus',[]).respond(200,{}); |
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
| .controller('UserInnerController', ['$scope', '$filter', | |
| function($scope, $filter) { | |
| $scope.user.created_at = $filter('tsToDate')($scope.user.created_at,'shortDate'); | |
| } | |
| ]) |
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
| .directive('lmLoader', function($parse){ | |
| var tpl = '<div id="loading"><i class="fa fa-spinner fa-spin fa-4x"></i></div>'; | |
| return { | |
| restrict: 'A', | |
| scope : { | |
| condition: '&' | |
| }, | |
| link: function(scope, element) { | |
| element.css('position','relative'); | |
| scope.$watch('condition()', function(){ |
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
| // NB solitamente la config viene dal server che scriverà come: | |
| var CONFIG = {/* la mia configurazione*/}; | |
| angular.module('myApp.services', []) | |
| .constant('CONFIG',CONFIG) | |
| .value('theme','ungranbeltheme:)') | |
| .factory('UserFactory', function($http, $q) { | |
| var service = { | |
| // our factory definition | |
| user: {}, | |
| setName: function(newName) { |
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
| in HomeController | |
| $token = csrf_token(); | |
| $this->layout->content = View::make('home.content')->with('data', array('token'=> $token, 'user'=> json_encode($userData))); | |
| in blade | |
| @section('content') | |
| <div class="content" data-ui-view></div> | |
| <script type="text/javascript"> | |
| window.user = <% $data['user'] %>; | |
| document.cookie = "XSRF-TOKEN=<% $data['token'] %>"; |
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
| var app = angular.module('plunker', []); | |
| app.controller('BoxController', ['$scope', function ($scope) { | |
| $scope.items = [1, 2, 3, 4, 5]; | |
| }]); | |
| app.directive('bxSlider', [function () { | |
| return { | |
| restrict: 'A', | |
| link: function (scope, element, attrs) { |
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(window, angular, _, undefined) { | |
| 'use strict'; | |
| var underscore = angular.module('underscore', []); | |
| underscore.factory('_', function() { | |
| return window._; //Underscore must already be loaded on the page | |
| }); | |
| })(window, angular, _); | |
| angular.module('myApp', ['underscore']) |
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 takePhoto() { | |
| navigator.camera.getPicture(cameraSuccess, cameraError, { | |
| quality : 50, | |
| destinationType: Camera.DestinationType.DATA_URL | |
| }); | |
| } | |
| function cameraSuccess(imageData) { |
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
| var inmomentNameSpace = angular.module('inmoment', []); | |
| inmomentNameSpace.controller('sampleController', function sampleController($scope,$timeout){ | |
| $scope.cats = []; | |
| db.transaction ( | |
| function(tx) { | |
| $("#catList").empty(); | |
| /* what's the hack is going on here ! | |
| * In the angularjs world is strictly forbidden | |
| * using reference to dom in the controller :) | |
| * Go with a directive instead. |
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('ItemsUpdateController', function ($scope, item, Items, $state) { | |
| $scope.item = item; | |
| $scope.item.$loaded().then(function(data) { | |
| $scope.item = data; | |
| }); | |
| $scope.add = function() { | |
| var item = {}; | |
| item.$id = $scope.item.$id; | |
| item.title = $scope.item.title; | |
| item.ingredients = $scope.item.ingredients; |