I've been trying like mad to get angularjs' ng-include to work properly with a Flask application, and it seems like no matter what I try, the GET keeps returning 404'd. The main page (angular_test.html) loads up fine, but nothing from angular_entry.html.
Flask:
basedir = c.get('basedir')
app = Blueprint('angulartest', __name__, static_folder=basedir+'/display/static',
template_folder=basedir+'/display/angulartemplates')
def before_blueprint_request():
g.user = current_user
app.before_request(before_blueprint_request)
@app.route('/angular_test.html', methods=['GET'])
def ang_test():
print 'testing angular'
return make_response(open(basedir+'/display/templates/angular_test.html').read())
#
# return app.send_static_file('angular_test.html') (I've tried both)
HTML:
<div id='content' ng-app='FeedEaterApp' ng-controller='MainController'>
<select ng-model="template" ng-options="t.name for t in templates">
<option value="">(blank)</option>
</select>
url of the template: <tt>{{template.url}}</tt>
<div ng-include src="'angular_entry.html'"></div>
<div ng-include src="template.url"></div>
<div ng-include="'angular_entry.html'"></div>
<div ng-include="template.url"></div>
</div>
JS:
app.controller("MainController", function($scope){
$scope.message = 'this is a message from scope!~'
$scope.templates =
[ { name: 'template1.html', url: 'angular_entry.html'},
{ name: 'template2.html', url: 'template2.html'} ];
$scope.template = $scope.templates[0];
});
I've also tried every single relative/absolute path I can think of, and still nothing but 404s. I've also tried changing around the static and template folders in Flask. No dice.
Is Flask interfering with the GET on angular_entry.html? Is my application root path not set correctly or something?
help!