小编Rak*_*ala的帖子

angularjs无法找到模板目录,烧瓶作为后端

我在客户端使用flask作为后端和angularjs

我的目录结构:

露:

  ->app.py

  ->templates
    ->hello.html
    ->test.html

  ->static
    ->js
      ->directives.py
    ->lib
      ->angular.js
Run Code Online (Sandbox Code Playgroud)

我的app.py文件:

from flask import Flask, make_response,render_template
@app.route("/aboutUs")
def aboutUs():
    return render_template("test.html", title="test page")
Run Code Online (Sandbox Code Playgroud)

我的directives.py文件:

angular.module('components',[])
    .directive("helloWorld",function($scope,$log){
        $scope.$log = $log;
        return{
            restrict:"A",
            templateUrl:"templates/hello.html"
        }
    })

angular.module('testApp',['components'])
Run Code Online (Sandbox Code Playgroud)

Flask能够正确渲染test.html模板,但angular显示了hello.html,找不到模板错误

flask angularjs angularjs-directive

5
推荐指数
1
解决办法
2119
查看次数

标签 统计

angularjs ×1

angularjs-directive ×1

flask ×1