doutang3077
doutang3077
2016-06-11 18:04
浏览 70

如何在基于Zend的php项目中使用angularjs模板

I have php framework based on Zend library and I'd like to use angularjs script in phtml file but I have problem how to include template edytuj_row.phtml located in:

ProjectName->SourceFiles->application->admin->views->settings->edytuj.phtml

<div row-settings></div>

<script type="text/javascript">
    var app = angular.module('mainApp', []);

    app.directive('rowSettings', function(){
        return {
            templateUrl: 'edytuj_row.phtml'            
        };
    });
</script>

Both files edytuj_row.phtml and edytuj.phtml are localizated in the same directory but edytuj_row.phtml is not seen. What is right path in templateUrl ? In this situation in place of <div row-settings></div> is loaded recurently main web page instead of template.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsgsdg206050
    dsgsdg206050 2016-06-13 11:11

    Angular has no access to Zend files (templates). You need to set valid URL to templateUrl (eg. /admin/users/edytuj-row)

    You probably have edytujAction and edytujRowAction. Check what URL path directs to edytujRowAction (probably in Bootstrap.php) and set it in templateUrl.

    点赞 评论

相关推荐