2015-01-11 28 views
-2

有沒有一種角度的方式來改變文件的名稱從哪個IM顯示主標籤中的內容?現在我只是使用PHP包括功能:更改包含的HTML文件點擊使用角度

<main> 
    <?php include 'hello.html';?> 
</main> 

但有一個「angulary」的解決方案來改變hello.html的文件,以讓說... goodbye.html?

+0

這可以幫到你 http://stackoverflow.com/questions/19415394/with-ng-bind-html-unsafe-removed-how-do-i-inject-html –

回答

1

是的,它很簡單。但我不明白你的情況,我無法向你展示PHP技術。

使用以下方法,

的Index.html

<main ng-init="loadPage()"> 
    <div ng-include="{{url}}"> 

    <div> 
    </main> 

Index.js

appModuleName.Controller("index",function($scope){ //appModumodleName is the name of your angular app module 

    $scope.loadPage=function() 
    { 
     // User your logic to get your desired HTML page url..... 

     $scope.url="hello.html"; //or path toward your hello.html 
    } 
}); 

任何疑問請隨時提問... 希望我幫助.. 。