The code works fine independently. However, when I deploy it on apache
(django based app) and static files/js are server from another location,
it doesn't work.
On Thursday, 6 March 2014 17:15:21 UTC+5:30, Sushant Jain wrote:
>
> Hello,
>
> I am trying to use requireJS, AngularJS in one of my prototypes.
>
> The angular styled mark-ups are not getting populated somehow. However, I
> noticed that only the ng-bind directive.
> Here is my code
>
> App.js
> --------
> requirejs.config({
> baseUrl: 'static/js',
>
> shim: {
> 'angular' : { exports: 'angular' },
> 'jquery' : { exports : 'jquery'},
> }
>
> });
>
> /**
> * CourseService
> */
> define(["services/courseService"],
> function(courses)
> {
>
> });
>
> --------------------
> courseService.js
>
> define(['angular'], function(angular){
>
> var mod = angular.module('app',[]);
> mod.factory('CourseService', function($http){
> var courseFactory = {};
> courseFactory.getCourses = function(){
> return $http.get("/api/v1/courses/")
> .then(function(result){
> return result.data.objects;
> })
> };
> return courseFactory;
>
> })
> mod.controller('CourseCtrl',function($scope,CourseService) {
> $scope.courses =
> CourseService.getCourses().then(function(data){
> $scope.courses = data;
> // the structure of the courses is like:
> // [ { title : 'test', small_image='sm.jpg'},{ title :
> 'test2', small_image='sm2.jpg'}]
> })
> });
>
> });
>
>
> -------------------------------------------------------
>
> app.html
>
> <!DOCTYPE html>
> <html ng-app="app">
> <head>
> </head>
> <body >
>
> <div ng-controller="CourseCtrl">
> <div ng-repeat="course in courses">
>
> <div>
> <img id='a' ng-src=" {{ course.small_image
> }}"></img>
> <span ng-bind='course.title'/>
> </div>
> </div>
> <script data-main="js/app" src="js/require.js"></script>
> </body>
> </html>
>
>
> Here, the markup in ng-src doesn't get populated, however for ng-bind it
> does and I can see the values up there.
>
> Can somebody please shed some light on this?
>
>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.