javascript - Using a Pyramid view for an AngularJS dialog template -


i have written web application using pyramid, python web framework.

in 1 page of web application, i'd implement dialogs. i'm trying learn angularjs angularui bootstrap achieve (here example of dialogs angularui).

my page show total of 7 dialogs. these dialogs display text , images, , receive , validate input. dialog flow not linear; there conditional dialogs , multiple branches of execution.

please @ this example of displaying angularui bootstrap dialog. example.js:5-21 configures dialog display options. parameter template contains html displayed:

template:  t, // or: templateurl: 'path/to/view.html', 

where, in example, var t contains static example markup:

var t = '<div class="modal-header">'+         '<h3>this title</h3>'+         ... 



now, in pyramid, urls not mapped directly files or folders; instead, urls compared registered routes. so, example, not make sense request http://site.com/path/to/view.html. instead, code:

config.add_route('my_route', '/my_feature')

@view_config(route_name='my_route', renderer='/path/to/view.html')

which render view.html if call http://site.com/my_feature.

how can use pyramid view templateurl?

because pyramid abstracts urls views, can't provide templateurl static html file (e.g. abc.html). url provide goes through pyramid's routing system.

i've tried giving templateurl static html files success. pyramid-routed url fails , dialog doesn't show up.

what's solution?


solution

i had accidentally used template instead of templateurl.

make sure says templateurl: '/your-pyramid-view' instead of template: '/your-pyramid-view'.

you should able serve static html files static view:

config.add_static_view(name='partials', path='yourpythonpackage:partials') 

if abc.html in yourpythonpackage/partials templateurl can set /partials/abc.html.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -