How to defer routes definition in Angular.js?

Since routes are defined on a provider level, normally new routes can only be defined in the configuration block. The trouble is that in the configuration block all the vital services are still undefined (most notably $http). So, on the surface it looks like w can’t define routes dynamically. Now, it turns out that in … Read more

How do I size a UITextView to its content on iOS 7?

I favor this minimal code change: Just add these two lines after addSubview and before grabbing the height of the frame … [scrollView1 addSubview: myTextView]; [myTextView sizeToFit]; //added [myTextView layoutIfNeeded]; //added CGRect frame = myTextView.frame; … This is tested backwards compatible with iOS 6. NOTE that it shrink-wraps the width. If you’re just interested in … Read more

C# ‘dynamic’ cannot access properties from anonymous types declared in another assembly

I believe the problem is that the anonymous type is generated as internal, so the binder doesn’t really “know” about it as such. Try using ExpandoObject instead: public static dynamic GetValues() { dynamic expando = new ExpandoObject(); expando.Name = “Michael”; expando.Age = 20; return expando; } I know that’s somewhat ugly, but it’s the best … Read more

Dynamic Anonymous type in Razor causes RuntimeBinderException

Anonymous types having internal properties is a poor .NET framework design decision, in my opinion. Here is a quick and nice extension to fix this problem i.e. by converting the anonymous object into an ExpandoObject right away. public static ExpandoObject ToExpando(this object anonymousObject) { IDictionary<string, object> anonymousDictionary = new RouteValueDictionary(anonymousObject); IDictionary<string, object> expando = new … Read more