Open rodrigodalcindev opened 9 years ago
As a reminder, @simonwalsh suggests using Bower to achieve this.
We can add custom options for these to our routes (like how we added requires: {user: true}
)
Example:
$routeProvider
.when '/foos',
meta:
keywords: 'fooseball, foose, foosing'
title: 'Fooseball'
layout:
body:
id: "foose-page"
class: 'full'
controller: 'FoosCtrl'
@joshnuss That would involve overriding routes.coffee
in the host app, correct? How would we later reference these custom options on the app's views (eg.: injecting the keywords
property to a meta
tag)?
@rodrigodalcindev
You can get them from the $route
object when you transition from start to success.
I would still advise for us to build a proper Status
module that would take care of this sort of things.
I started a proof of concept in reformation and it looks like so:
.when '/products',
requires: {setup: true}
controller: 'ProductListCtrl'
templateUrl: 'products/index.html'
status:
page: "products"
bodyClass: "s-products is-nav--dark"
... and in the Status
service:
status =
initialized: false
pageTitle: ""
requestedPath: null
httpLoading: false
routeChanging: false
manuallyLoading: false
cachedProducts: []
meta: {}
$body: angular.element('body')
page: null
previous: null
I would love for us to set those in the routes
and override them in the controllers if needed. This way you don't need to create a controller just to set the meta of a page...
I have many ideas for this module so I can assign that to me!
@rodrigodalcindev @simonwalsh Good points
What do you think about defining "status" settings in a different file? Like have a status.coffee
(we should find a better name then "status")
e.g.
YourApp.config ($statusProvider) ->
$statusProvider
.when '/products',
title: "Shirts"
keywords: "Awesome"
.when ...
That way sites dont have to override routes or controllers to adjust meta stuffs
@joshnuss Exactly what I had in mind!
The way I see it is :
0 being the lowest priority. This way we would have a convenient and flexible meta service.
@simonwalsh big :+1:
Global properties support should be improved through an augmented
Status
or route-based service. Some of these are essential to any web app and make front-end development work much easier, for example: