angularjs - Integrate Angular JS in Symfony2 -
i try integrate angularjs symfony2 having difficulty below find code of page base.html.twig , code of page app.js
<html lang="fr" ng-app="routeapp"> <head> <meta charset="utf-8" /> <title> {% block title %} accueil ! {% endblock %} </title> {% block stylesheets %} <link rel="stylesheet" href="{{ asset('bundles/ardbackend/components/bootstrap/dist/css/base-admin.css') }}" type="text/css" /> <link href="{{ asset('bundles/ardbackend/components/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet" type="text/css"/> <link href="{{ asset('bundles/ardbackend/components/bootstrap/dist/css/bootstrap-responsive.min.css') }}" rel="stylesheet" type="text/css"/> <link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" /> {% endblock %} {% block javascripts %} <script src="{{ asset('bundles/ardbackend/components/angular/angular.min.js') }}"></script> <script src="{{ asset('bundles/ardbackend/components/angular/angular-route.js') }}"></script> <script src="{{ asset('bundles/ardbackend/components/angular/app.js') }}"></script> <script src="{{ asset('bundles/ardbackend/bootstrap/dist/js/bootstrap.min.js') }}"></script> <script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script> <script src="{{ path('fos_js_routing_js', {"callback": "fos.router.setdata"}) }}"></script> {% endblock %} </head> <body> <div ng-view> <nav> <a href="#/login" class="btn btn-primary">page d'accueil</a> <a href="#/" class="btn btn-success">page de contact</a> </nav> {% block body %} {% endblock %} </div> </body>
, app.js
'use strict'; /** * déclaration de l'application routeapp */ var routeapp = angular.module('routeapp', [ // dépendances du "module" 'ngroute' ]); /** * configuration du module principal : routeapp */ routeap p.config(['$routeprovider',function($routeprovider) { // système de routage $routeprovider .when('/login', { templateurl: routing.generate('login'), controller: securitycontroller }) .when('/', { templateurl: routing.generate('pour_test'), controller: defaultcontroller }) .otherwise({ redirectto: '/login' }); }]);
i did not understand, what's missing in code make work please ?
try change start , ending symbols in angular , because understood conflicts same notation
custominterpolationapp.config(function($interpolateprovider) { $interpolateprovider.startsymbol('//'); $interpolateprovider.endsymbol('//'); });;
Comments
Post a Comment