0
所以,我試圖設置我的第一個角度的應用程序,問題是通過ajax檢索的模板不是由Angular插值。我使用Ruby Sinatra框架對於簡單的HTTP,和這裏代碼的主要部分包括: 的index.htmlAngular和Sinatra,加載在ajax上的模板不是插值的
<div ng-view></div>
main.js
var app = angular.module('myApp', ['ngRoute']);
app.config(function($routeProvider) {
$routeProvider.when('/', {
templateUrl: 'templates/home.html',
controller: 'HomeController'
})
})
app.controller('HomeController', function($scope) {
});
home.html做爲
{{ 1 + 1 }}
西納特拉app.rb
#!/usr/bin/env ruby
require 'sinatra'
class HelloWorldApp < Sinatra::Base
get '/' do
send_file 'index.html'
end
get '/js/:name' do
send_file "js/#{params[:name]}"
end
get '/templates/:name' do
send_file "templates/#{params[:name]}"
end
end
現在,當我加載http://localhost:9292/
我得到的{{ 1 + 1 }}
代替2
。什麼問題呢?
沒關係,它只是我的代碼中的一個錯字。 – Zed