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
module.component('helloNavFetch', { | |
controller: ['Me', function(Me) { | |
var ctrl = this; | |
this.$onInit = function () { | |
ctrl.loading = true; | |
Me.query().$promise.then(function (me) { | |
ctrl.me = me; | |
ctrl.loading = false; | |
}); | |
}; |
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
module.component('helloNavFetch', { | |
controller: ['Me', function(Me) { | |
var ctrl = this; | |
this.$onInit = function () { | |
ctrl.loading = true; | |
Me.query().$promise.then(function (me) { | |
ctrl.me = me; | |
ctrl.loading = false; | |
}); | |
}; |
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
module.config(['$routeProvider', function ($routeProvider) { | |
$routeProvider | |
.when('/hello', { | |
template: '<hello-nav me="$resolve.me"></hello-nav>', | |
resolve: { | |
'me': ['Me', function (Me) { | |
return Me.query().$promise; | |
}] | |
} | |
}); |
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
describe("hello nav component", function(){ | |
// globals set up and used in each test scenario | |
var $componentController; | |
beforeEach(module('app')); | |
beforeEach(inject(function(_$componentController_) { | |
$componentController = _$componentController_; | |
})); |
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
describe("hello nav", function(){ | |
// globals set up and used in each test scenario | |
var scope, element; | |
beforeEach(module('app')); | |
beforeEach(inject(function($rootScope, $compile) { | |
scope = $rootScope.$new(); | |
element = angular.element('<hello-nav me="me"></hello-nav>'); | |
element = $compile(element)(scope); |
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
<hello-nav me="{first_name: 'Aleck', last_name: 'Landgraf'}"></hello-nav> |
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
module.component('helloNav', { | |
bindings: { | |
me: '<' | |
}, | |
template: `<div class="section-nav"> | |
<h2>Hello {{ $ctrl.me.first_name }} {{ $ctrl.me.last_name }}</h2> | |
</div>` | |
}); |
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
# This creates some bad audit_types | |
class AuditLog(models.Model): | |
LOG = 'lo', | |
NOTE = 'no', | |
AUDIT_CHOICES = ( | |
(LOG, 'log'), | |
(NOTE, 'note', | |
) | |
audit_type = models.CharField(choices=audit_CHOICES) |
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
(defn home-page [request] | |
(let [flash (:flash request)] | |
(layout/render | |
"home.html" | |
(merge {:messages (db/get-messages)} | |
(select-keys flash [:name :message :errors])))) ) |
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
# string format with kwargs | |
user = { | |
'first_name': 'John', | |
'last_name': 'Doe', | |
'email': '[email protected]', | |
} | |
user_bio = '{first_name} is registered with email: {email}'.format(**user) | |
# string format with an object | |
class User(object): |