Sane, scalable Angular apps are tricky, but not impossible. Lessons learned from PayPal Checkout.

<div ng-controller="myController">
<strong>{{foo}}</strong>
</div>
$routeProvider.
when('/phones', {
templateUrl: 'partials/phone-list.html',
controller: 'PhoneListCtrl'
})
myapp.directive('foo', function() {
return {
scope: {},
template: myTemplate,
controller: function($scope) {
$scope.foo = 'bar';
}
};
});
$routeProvider.
when('/phones', {
template: '<phone-list></phone-list>',
})
scope: {}
scope: true
<input type="text" ng-model="username" />
<input type="text" ng-model="user.name" />
myapp.directive('foo', function() {
return {
scope: {
bar: '='
},
template: myTemplate,
controller: function($scope) {
console.log($scope.bar);
}
};
});
<foo bar="baz"></foo>
myapp.factory('foo', function() {
return something;
});
#/checkout/review/sidebar/addcard
$http.get('/foo/bar').then(function(result) {
console.log('Success!', result);
});
$http.get('/foo/bar').then(function(result) {
console.log('Success!', result);
}).catch(function(err) {
console.error(err.stack);
});
$scope.foo = function() {
return {bar: 'baz'};
};
var data = {bar: 'baz'};$scope.foo = function() {
return data;
};

--

--

I write code, sometimes my code works. daniel@bluesuncorp.co.uk

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store